在Oracle 10g上運行Pro * C。Oracle ProC插入值((選擇...))
我期待在插入語句值子句中執行子查詢。這個sql查詢是完全有效的,並且在TOAD內運行時沒有問題,但Pro * C無法解析查詢。
EXEC SQL INSERT INTO TARGET_ATTACHMENT
(
TARGET_ID
FILENAME
)
VALUES (
:targetID,
(SELECT CREATED_FLAG from TARGET t where t.TARGET_ID = :targetID) || '.tif'
)
如果我刪除:
(SELECT (CREATED_FLAG || DISPLAY_ID) from TARGET t where t.TARGET_ID = :targetID) ||**".
的PRO * C編譯器的工作和一切編譯和運行正常。如果我不刪除: Pro * C編譯器會引發語法錯誤。
1>Syntax error at line 128, column 12, file d:\SVN\...\TA.pc:
1>Error at line 128, column 12 in file d:\SVN\...
1>...\TA.pc
1> (select CREATED_FLAG from target t where t.TARGET_ID = :targetID)
1>...........1
1>PCC-S-02201, Encountered the symbol "CREATED_FLAG" when expecting one of the fol
1>lowing:
1> () * + -/. @ | at, day, hour, minute, month, second, year,
這是一個問題,因爲我希望PRO * C能夠編譯值範圍內subquerys caluse:
即。
INSERT into table1 (col1) values ((select t2.singleCol from table2 t2 where t2.priKey = :priKey))
這是Pro * C的預期行爲嗎?還是應該支持values子句中的子查詢?
我只顯示一個簡單的查詢來顯示什麼打破了(在我加入子查詢後)。 TARGET_ATTACHMENT表中實際插入了20多個字段,其中只有一個需要來自TARGET表的信息。 – user297500