2015-11-18 127 views
-3

創建光標時,我有一個非常簡單的腳本來嘗試光標的功能,但它無效的報道create命令。任何人都知道可能是什麼原因?謝謝!錯誤甲骨文

create lot_1 cursor for select * from temp_minj1.lot 
+1

https://docs.oracle.com/cd/B19306_01/appdev.102/b14261/sqloperations.htm #BABHICAF – Blorgbeard

+0

哪個SQL類型?更多信息? – Coffee

+1

我投票結束這個問題作爲題外話,因爲沒有顯示最小的研究。 –

回答

1

在Oracle,SQL語法是這樣的:

DECLARE 
    my_emp_id  NUMBER(6);  -- variable for employee_id 
    my_job_id  VARCHAR2(10); -- variable for job_id 
    my_sal  NUMBER(8,2); -- variable for salary 
    CURSOR c1 IS SELECT employee_id, job_id, salary FROM employees 
     WHERE salary > 2000; 
    my_dept departments%ROWTYPE; -- variable for departments row 
    CURSOR c2 RETURN departments%ROWTYPE IS 
     SELECT * FROM departments WHERE department_id = 110; 

see source