???SQL?????????
???????????? ???????[ 2013/4/17 9:57:26 ] ????????
????2?????????schema?????????????
?????????????У????SQL?????????????????????????????????
DECLARE
sql_stmt VARCHAR2(100);
v_count NUMBER;
BEGIN
EXECUTE IMMEDIATE 'SELECT COUNT(*) FROM :tb_name'
INTO v_count;
DBMS_OUTPUT.PUT_LINE('The table record is ' || v_count);
END;
DECLARE
*
ERROR at line 1:
ORA-00903: invalid table name
ORA-06512: at line 5
?????????
DECLARE
sql_stmt VARCHAR2(100);
v_tablename VARCHAR2(30) :='scott.emp'; --????????????????
v_count NUMBER;
BEGIN
EXECUTE IMMEDIATE 'SELECT COUNT(*) FROM ' || v_tablename --???|| ???????
INTO v_count;
DBMS_OUTPUT.PUT_LINE('The table record is ' || v_count);
END;
The temp table count is 14
????3?????SQL?鯔????÷?????(;)
?????????????У????SQL??????????????????????????????
DECLARE
sql_stmt VARCHAR2(100);
--v_tablename VARCHAR2(30) :='scott.emp';
v_count NUMBER;
BEGIN
EXECUTE IMMEDIATE 'SELECT COUNT(*) FROM tb_emp;' --?????????????????
INTO v_count;
DBMS_OUTPUT.PUT_LINE('The temp table count is ' || v_count);
END;
DECLARE
*
ERROR at line 1:
ORA-00911: invalid character
ORA-06512: at line 6
?????????
?????????SQL????β????
????4?????PL/SQL?鯔???????б?????????飬??????β?????????÷??(;)
DECLARE
plsql_block VARCHAR2(300);
BEGIN
plsql_block := 'DECLARE ' ||
' v_date DATE; ' ||
' BEGIN ' ||
' SELECT SYSDATE INTO v_date FROM DUAL; ' ||
' DBMS_OUTPUT.PUT_LINE (TO_CHAR(v_date??''YYYY-MM-DD''));' ||
'END;
/'; --????????/????y??????
EXECUTE IMMEDIATE plsql_block;
END;
DECLARE
*
ERROR at line 1:
ORA-06550: line 3?? column 2:
PLS-00103: Encountered the symbol "/" The symbol "/" was ignored.
ORA-06512: at line 13
?????????
?????????PL/SQL ??β????б??
??????
???·???
??????????????????
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