开发者

Oracle Option Keyword

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 w开发者_JAVA百科hat 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?


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;


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜