problem in getting Scope_Identity in Oracle????

S

Sally.mokhtar

Hi All,
i'm converting my website from connecting to SQL to Connect to Oracle DB and i'm reconfiguring the DataSets and TableAdapters for that .
i have function in a tableAdapter that insert in a table then get the SCOPE_IDENTITY() of the ID of the last inserted row .
This the Code that refer to SQL DB:

INSERT INTO [JobFunction] ([JobFunctionName]) VALUES (@JobFunctionName); SELECT SCOPE_IDENTITY()

And This the Code that refer to ORACLE DB:

INSERT INTO JOBFUNCTION
(JOBFUNCTIONNAME)
VALUES :)JOBFUNCTIONNAME);
SELECT JOBFUNCTION_SEQ.nextval
FROM dual

The proplem is the last code generate an error : ORA-00911 invaild character
that's because i use ; to separate the INSERT statment from SELECT statment
and if i remove the ; it generates another error : ORA-00933 sql command not properly ended !!!!!!!!!!
Please Help Meeeeeeeeeeeeeeeeeeeeeeeeee
 
D

David R. Longnecker

What about putting this logic into a stored procedure that accepts the values
you're entering and returns a number?

Another option, though I haven't tested it to see if it'd work, might be
to keep the code inline, but assign your next sequence value to an output
parameter and capture the output parameter via the OracleClient class or
however your data access code is structured.

HTH.

-dl
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top