Subject | Writing A Stored Procedure ?? |
---|---|
Author | Anand |
Post date | 2003-07-22T10:46:24Z |
I am trying to write a stored procedure to do the following:
It should accept two parameters. It should search a specific
table to see if Field1 and Field2 of any record contain the
values of the two parameters. If no such records are found, a
new record should be inserted with the values of the parameters
going into Field1 and Field2.
*******
begin
/* Procedure Text */
SELECT COUNT(*) FROM CC_USERS WHERE DR_ID=:"str_DR_ID" AND
CC_USER=:"int_USER_ID" into :tmp_count
IF :tmp_count = 0 then
INSERT INTO CC_USERS VALUES (:"str_DR_ID", :"int_USER_ID")
suspend;
end
*****
This is the SQL I have written so far. Whatever I try to do, it
gives me an error when compiling, flagging up the IF statement
or sometimes even the SELECT statement as an Invalid token.
Thanks in advance,
-Anand
__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com
It should accept two parameters. It should search a specific
table to see if Field1 and Field2 of any record contain the
values of the two parameters. If no such records are found, a
new record should be inserted with the values of the parameters
going into Field1 and Field2.
*******
begin
/* Procedure Text */
SELECT COUNT(*) FROM CC_USERS WHERE DR_ID=:"str_DR_ID" AND
CC_USER=:"int_USER_ID" into :tmp_count
IF :tmp_count = 0 then
INSERT INTO CC_USERS VALUES (:"str_DR_ID", :"int_USER_ID")
suspend;
end
*****
This is the SQL I have written so far. Whatever I try to do, it
gives me an error when compiling, flagging up the IF statement
or sometimes even the SELECT statement as an Invalid token.
Thanks in advance,
-Anand
__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com