Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Variable in DB2

Status
Not open for further replies.

rwaldron

MIS
Aug 6, 2002
53
IE
Hi all,
Sorry if this is the wrong place to ask but I have tried a few places with no joy.
In SQL when querying using a variable I can use @ symbol.
ie:
SELECT COUNT(*) FROM dbo.Persons WHERE SocialSecurityNumber = @SocialSecurityNumber
Then in say visual web developer this would prompt me to enter the variable for @SocialSecurityNumber
This all works perfect.
My issue is when I query a DB2 DB directly say
SELECT COUNT(*)
FROM DB2.table
WHERE (MMITNO = @MMITNO)
I get ther error "Column @MMITNO does not exist"
My question is. What symbol do I use to represent variable in DB2.
In SQL it is @ ..I think these symbols are known as sigils
Please Help
Ray..
 
I do not know if this is possible with 'interactive' (if that's the word) SQL, but my DB2 sources indicate the use of:

Code:
:

The application that you use would need to support the cursor variable

Ties Blom

 
Hi all,
Just to let you know.
I got it working.

In SQL its WHERE MMITNO =@MMITNO
IN db2 its WHERE MMITNO = ?

Thx,
Ray..
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top