Menu

#3 Column Name function

open
nobody
None
5
2003-06-25
2003-06-25
Anonymous
No

I would like to see some kind of function to help with
generation of SQL statements in code. Here's what I
currently do, with Oracle 8.1.7. I create a query with
the following:

select '"'||column_name||',"+' from user_tab_columns
where table_name = 'TABLE_ABC'

It returns a query result like this:
" COLUMN_1, " + ;
" COLUMN_1, " + ;
" COLUMN_2, " + ;

I can then paste the results into a String that also
contains the rest of the SQL statement, for example
String mySQL = "SELECT " +
[pasted code here]
" FROM TABLE_ABC ";

The only problem is that the pasted code has semicolons
at the end of each line. Plus, I have to remove the
comma from the last column name. I would like to see
something to help create SQL statements with each
column listed. Feel free to contact me at hawkwall at
yahoo dot com.

Mike Wall

Discussion


Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.