If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > sql help

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 10-23-08, 12:18
db2link db2link is offline
Registered User
 
Join Date: Jan 2008
Posts: 13
sql help

HI all , I'm not too savvy when it comes to sql..can please someone tell me the following

select col1 from table1 where col2 =?

thankx

Last edited by db2link; 10-23-08 at 13:32.
Reply With Quote
  #2 (permalink)  
Old 10-23-08, 13:46
madhu_kaza madhu_kaza is offline
Registered User
 
Join Date: Apr 2008
Posts: 39
question mark indicates parameter markers.

When we want to pass value dynamically to a query we use these parameter markers.

SELECT col1 FROM table1 WHERE col2=?

means dynamically you can pass value to col2 in WHERE clause.
Reply With Quote
  #3 (permalink)  
Old 10-24-08, 01:50
Marcus_A Marcus_A is offline
Registered User
 
Join Date: May 2003
Location: USA
Posts: 5,196
When a statement has parameter markers it means it has been prepared without any specific value to be used in place of the ?, and the SQL is compiled into a package and stored in package cache. Then when the prepared statement is executed, the value is supplied and substituted by DB2. This allows an SQL statement to be compiled (and access plan determined) once, but reused many times without having to recompile each time.
__________________
M. A. Feldman
IBM Certified DBA on DB2 for Linux, UNIX, and Windows
IBM Certified DBA on DB2 for z/OS and OS/390
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On