Get the error in the code

Hi gurus

I'm doing some practice for learning purpose and need your help to identify the error.

Examples of data

DROP TABLE plch_parts;

CREATE TABLE plch_parts

(

partNum NUMBER PRIMARY KEY,

partName SINGLE VARCHAR2 (15)

) ;

Create Procedure

CREATE OR REPLACE

Get_rows PROCEDURE)

table_in IN VARCHAR2)

IS

Plch_nums_t TYPE TABLE IS NUMBER;

Plch_names_t TYPE IS a TABLE OF VARCHAR2 (100);

l_partnums plch_nums_t;

l_partnames plch_names_t;

BEGIN

RUN IMMEDIATELY "START

SELECT * BULK COLLECT

IN: l_partnums: l_partnames OF ' | table_in | '; END; "With the HELP OF THE l_partnums, THE l_partnames;

Dbms_output.put_line (l_partnums. (COUNT);

END;

Error

Error (9.3): PL/SQL: statement ignored
Error (11.73): PLS-00457: expressions must be SQL types.

Appreciate your guidance.

Concerning

Shu

Something like this will compile.

RUN IMMEDIATELY.
SELECT partnum, partname of ' | table_in BULK COLLECT INTO l_partnums, l_partnames;

Here to remember

In addition, if you create SQL data types using the following at the SQL prompt then

create or replace
TYPE plch_nums_t AS TABLE OF NUMBER;
create or replace TYPE plch_names_tAS TABLE OF VARCHAR2 (100);

Then the following procedure compiles:

create or replace PROCEDURE get_rows (table_in IN VARCHAR2) IS
l_partnums plch_nums_t;
l_partnames plch_names_t;
BEGIN
EXECUTE IMMEDIATE ' BEGIN SELECT * COLLECT LOOSE: l_partnums,: l_partnames OF ' | table_in | '; END; "With the HELP OF THE l_partnums, THE l_partnames;
Dbms_output.put_line (l_partnums. (COUNT);
END;

Steven Feuerstein can explain much better that me, so request you it read that. It is the PL/SQL challenge, isn't it?

Tags: Database

Similar Questions

Maybe you are looking for