150樓
郫都網(wǎng)站建設(shè)公司成都創(chuàng)新互聯(lián)公司,郫都網(wǎng)站設(shè)計(jì)制作,有大型網(wǎng)站制作公司豐富經(jīng)驗(yàn)。已為郫都上千余家提供企業(yè)網(wǎng)站建設(shè)服務(wù)。企業(yè)網(wǎng)站搭建\外貿(mào)營(yíng)銷(xiāo)網(wǎng)站建設(shè)要多少錢(qián),請(qǐng)找那個(gè)售后服務(wù)好的郫都做網(wǎng)站的公司定做!我連接到HR用戶并運(yùn)行了如下語(yǔ)句:
CREATE TABLE plch_parts ( partnum NUMBER , partname VARCHAR2 (50) ) / BEGIN INSERT INTO plch_parts VALUES (1, 'Chassis'); COMMIT; END; / CREATE OR REPLACE PACKAGE plch_pkg IS TYPE parts_t IS TABLE OF plch_parts%ROWTYPE INDEX BY PLS_INTEGER; PROCEDURE plch_show_parts (parts_in IN parts_t); END; / CREATE OR REPLACE PACKAGE BODY plch_pkg IS PROCEDURE plch_show_parts (parts_in IN parts_t) IS BEGIN FOR indx IN 1 .. parts_in.COUNT LOOP DBMS_OUTPUT.put_line (parts_in (indx).partname); END LOOP; END; END; / GRANT SELECT ON plch_parts TO scott / GRANT EXECUTE ON plch_pkg TO scott /
然后我又用SCOTT用戶連接并創(chuàng)建了這張表:
CREATE TABLE plch_parts ( partnum NUMBER , partname VARCHAR2 (50) ) / BEGIN INSERT INTO plch_parts VALUES (100, 'Wheel'); COMMIT; END; /
下列的哪些選項(xiàng)包含了下列語(yǔ)句塊的一個(gè)聲明部分,從而使得這個(gè)塊執(zhí)行之后"Wheel"會(huì)被顯示出來(lái)?
BEGIN SELECT * BULK COLLECT INTO l_parts FROM plch_parts; hr.plch_pkg.plch_show_parts (l_parts); END;
(A)
DECLARE TYPE parts_t IS TABLE OF plch_parts%ROWTYPE INDEX BY PLS_INTEGER; l_parts parts_t;
SQL> DECLARE 2 TYPE parts_t IS TABLE OF plch_parts%ROWTYPE INDEX BY PLS_INTEGER; 3 4 l_parts parts_t; 5 6 BEGIN 7 SELECT * BULK COLLECT INTO l_parts FROM plch_parts; 8 9 yoga.plch_pkg.plch_show_parts(l_parts); 10 END; 11 / DECLARE TYPE parts_t IS TABLE OF plch_parts%ROWTYPE INDEX BY PLS_INTEGER; l_parts parts_t; BEGIN SELECT * BULK COLLECT INTO l_parts FROM plch_parts; yoga.plch_pkg.plch_show_parts(l_parts); END; ORA-06550: 第 9 行, 第 3 列: PLS-00306: 調(diào)用 'PLCH_SHOW_PARTS' 時(shí)參數(shù)個(gè)數(shù)或類(lèi)型錯(cuò)誤 ORA-06550: 第 9 行, 第 3 列: PL/SQL: Statement ignored SQL>
(B)
DECLARE TYPE parts_t IS TABLE OF hr.plch_parts%ROWTYPE INDEX BY PLS_INTEGER; l_parts parts_t;
SQL> DECLARE 2 TYPE parts_t IS TABLE OF yoga.plch_parts%ROWTYPE INDEX BY PLS_INTEGER; 3 4 l_parts parts_t; 5 6 BEGIN 7 SELECT * BULK COLLECT INTO l_parts FROM plch_parts; 8 9 yoga.plch_pkg.plch_show_parts(l_parts); 10 END; 11 / DECLARE TYPE parts_t IS TABLE OF yoga.plch_parts%ROWTYPE INDEX BY PLS_INTEGER; l_parts parts_t; BEGIN SELECT * BULK COLLECT INTO l_parts FROM plch_parts; yoga.plch_pkg.plch_show_parts(l_parts); END; ORA-06550: 第 9 行, 第 3 列: PLS-00306: 調(diào)用 'PLCH_SHOW_PARTS' 時(shí)參數(shù)個(gè)數(shù)或類(lèi)型錯(cuò)誤 ORA-06550: 第 9 行, 第 3 列: PL/SQL: Statement ignored SQL>
(C)
DECLARE l_parts hr.plch_pkg.parts_t;
SQL> DECLARE 2 l_parts yoga.plch_pkg.parts_t; 3 4 BEGIN 5 SELECT * BULK COLLECT INTO l_parts FROM plch_parts; 6 7 yoga.plch_pkg.plch_show_parts(l_parts); 8 END; 9 / Wheel PL/SQL procedure successfully completed SQL>
(D)
DECLARE SUBTYPE parts_t IS hr.plch_pkg.parts_t; l_parts parts_t;
SQL> DECLARE 2 SUBTYPE parts_t IS yoga.plch_pkg.parts_t; 3 l_parts parts_t; 4 5 BEGIN 6 SELECT * BULK COLLECT INTO l_parts FROM plch_parts; 7 8 yoga.plch_pkg.plch_show_parts(l_parts); 9 END; 10 / Wheel PL/SQL procedure successfully completed SQL>
實(shí)測(cè)用yoga代替hr,test代替scott
答案在158樓
2011-11-16 答案CD.
%ROWTYPE是一種記錄,如果你定義兩個(gè)結(jié)構(gòu)一模一樣的記錄類(lèi)型,它們?nèi)匀徊荒軌蚧Q,會(huì)報(bào)類(lèi)型不匹配的錯(cuò)誤。