Question

I would like to ask if anybody has any knows how to use the OPTION keyword.

I have encountered this on an old C source code that I have been reading.

OPTION SELECT ROWID
FROM TABLE_1
WHERE PRODUCT_CODE = ANY(SELECT PRODUCT_CODE FROM PRODUCT_TABLE WHERE PRODUCT_GROUP='value a')
FOR UPDATE NOWAIT;
SELECT ROWID
FROM TABLE_2
WHERE PRODUCT_CODE = 'value b'
FOR UPDATE NOWAIT;
UPDATE TABLE_3
SET ...
WHERE PRODUCT_CD = 'value b'

*Updated Query based on first comment. Basically the C code made an SQL statement with 3 sql statement. Then got a result from it. I was wondering what would the oracle return if you give two statement. Which select statement result would it return? or would it just return the second one because the first one was specified with OPTION keyword?

Was it helpful?

Solution

Can you post any more of your code? OPTION is a reserved word so it can't be redefined.

It is typically used for operations such as:

GRANT CREATE INDEX TO user WITH ADMIN OPTION;

OTHER TIPS

Book "Oracle Database SQL Language Reference" contains the keyword "OPTION". http://download.oracle.com/docs/cd/B28359_01/network.111/b28531/authorization.htm#sthref821

As an Oracle keyword that doesn't seem to make sense there. If this is a Pro*C file, is there a macro defined somewhere that sets OPTION to something like exec sql, or since this looks like it could be a cursor, exec sql declare something cursor for? Though the latter would make the cursor name fixed to something so you could only use it once per file; perhaps this is shorthand for declaring a cursor called option...

Seeing more code around this would be helpful though.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top