我试图朗读这个程序,但看起来它不会导致

时间:2016-07-29 07:37:39

标签: plsql

create or replace procedure nestedTableColumnDemo is
    --i have tried to create netsed table  
    TYPE address_nest1 is TABLE OF varchar2(50);    

    --using varchar i tried to create a table but it gives an error i have no idea why.
    var1 varchar2(100); 
begin 

   --this is where i created the table using a variable var1
   var1:='create table customer_info(name varchar2(50),postal_address address_nest1) nested table postal_address store as postal_address_tab';        
   execute immediate var1;

end nestedTableColumnDemo;

execute nestedTableColumnDemo;

当我尝试执行此操作时,它会显示错误但不会创建表。

1 个答案:

答案 0 :(得分:0)

CREATE OR REPLACE TYPE address_nest1 IS TABLE OF VARCHAR2(10)
/   

 create or replace procedure nestedTableColumnDemo is   --i have tried to create netsed table  
    var1 varchar2(200);--using varchar i tried to create a table but it gives an error i have no idea why.
    begin 
    var1:='create table customer_info
    (name varchar2(50),
    postal_address address_nest1) 
    nested table postal_address store as postal_address_tab'; --this is where i created the table using a variable var1
    execute immediate var1;

    end nestedTableColumnDemo;
    /

    execute nestedTableColumnDemo;
    /

这是作品。