gslice Posted December 15, 2005 Share Posted December 15, 2005 Using DB2. Is there a way that an SQL SELECT statement WHERE clause can prompt the user for a value to enter? Looking to have the statement ask for the field value, then use it to process the SELECT. If anyone is familiar with the UniVerse (U2 by IBM) database, it allows you to set up inline prompting for it's LIST/SELECT statements. I want to do something similar. I'm guessing though I may have to resort to coding it in. Thanks. Link to comment Share on other sites More sharing options...
aspnetguy Posted December 15, 2005 Share Posted December 15, 2005 http://www.orafaq.com/node/515The above articel talks about using variables in oracle. The user is prompted for a value to the variable. This is only in SQL Plus (SQL command prompt).Are you doing this through a web application of are you working directly with the Database interface?If you are doing this through a web app you will need javascript and a server side lanaguage to handle this. Link to comment Share on other sites More sharing options...
gslice Posted December 15, 2005 Author Share Posted December 15, 2005 I'm using/testing Oracle Application Server 10g to access the DB2 database through a Web portlet. We've made the connection to DB2 and can pull back data from the tables into the Web page, but was looking for a simple way (within the SQL statement would be easiest if possible) to have the user input a field value for the SQL statement to go get. Link to comment Share on other sites More sharing options...
aspnetguy Posted December 15, 2005 Share Posted December 15, 2005 well according to the article you should be able to do something like this. SQL> select owner from dba_tables where table_name='&FRED' then it should play out like this...note where the user is prompted for a value SQL> select owner from dba_tables where table_name='&FRED'SQL> /Enter value for fred: DUALold 1: select owner from dba_tables where table_name='&FRED'new 1: select owner from dba_tables where table_name='DUAL'OWNER------------------------------SYS1 row selected. Hope this helps Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now