???SQL?????????
???????????? ???????[ 2013/4/17 9:57:26 ] ????????
????5??????????????
?????????????ж??tb_emp???£???????????μ?sal?У???????USING NULL????????????
DECLARE
sql_stmt VARCHAR2(100);
v_empno NUMBER := 7900;
BEGIN
sql_stmt := 'UPDATE tb_emp SET sal = :new_sal WHERE empno=:eno';
EXECUTE IMMEDIATE sql_stmt
USING NULL??v_empno; --?????????????NULL
END;
USING NULL??v_empno;
*
ERROR at line 7:
ORA-06550: line 7?? column 11:
PLS-00457: expressions have to be of SQL types
ORA-06550: line 6?? column 3:
PL/SQL: Statement ignored
?????????????
DECLARE
sql_stmt VARCHAR2(100);
v_empno NUMBER := 7900;
v_sal NUMBER; --????????±????????????
BEGIN
sql_stmt := 'UPDATE tb_emp SET sal = :new_sal WHERE empno=:eno';
EXECUTE IMMEDIATE sql_stmt
USING v_sal?? v_empno;
COMMIT;
DBMS_OUTPUT.PUT_LINE('The new sal is NULL');
END;
????6??????????????????????
???????USING????????????SQL?????INTO??????????????????????????????д???
??????????????????v_ename??v_sal????????????????????INTO???С?????????????′??????????????????????????????????????????????????д????????
DECLARE
TYPE emp_cur_type IS REF CURSOR;
emp_cv emp_cur_type;
sql_stat VARCHAR2(100);
v_dno NUMBER := &dno;
v_ename VARCHAR2(25);
v_sal NUMBER;
BEGIN
sql_stat := 'SELECT ename??sal FROM scott.emp WHERE deptno = :dno';
OPEN emp_cv FOR sql_stat --????α?????????SQL
USING v_dno;
LOOP
FETCH emp_cv
INTO v_sal?? v_ename; --?????????????????????????
EXIT WHEN emp_cv%NOTFOUND;
dbms_output.put_line('Employee name is ??' || v_ename ||
'?? The sal is ??' || v_sal);
END LOOP;
CLOSE emp_cv;
END;
Enter value for dno: 20
old 5: v_dno NUMBER := &dno;
new 5: v_dno NUMBER := 20;
DECLARE
*
ERROR at line 1:
ORA-01722: invalid number
ORA-06512: at line 14
?????????
?????????????????????
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11