Variables in SQL statements

Поиск
Список
Период
Сортировка
От suhail sarwar
Тема Variables in SQL statements
Дата
Msg-id PM.3438.988563324@pmweb6.uk1.bibliotech.net
обсуждение исходный текст
Список pgsql-novice
Can I use a java variable in an SQL statement written in a java program?

I am trying to have user input for my java program which takes input variables from a user and inserts them into my
postgresqldatabase. 

The problem is that at the moment I get an attribute not found error. Below is a snippit of the code:

...<<buffreredReader code here...>>...
String name = tKeyboard.readLine();
st.executeUpdate("INSERT INTO TEST13 " + "VALUES (name)");

The program compiles ok, but when run the program says attribute 'name' not found under SQL Exception.

Any help is much appreciated.

Kind Regards

Sarwar

В списке pgsql-novice по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: UPDATE and INDEX on expensive function with (IsCachable)
Следующее
От: "suhail sarwar"
Дата:
Сообщение: Multiple SQL statements in a java program for postgresql DB