can we use multiple sql statements in a procedure?
DBAsupport.com Forums - Powered by vBulletin
Results 1 to 4 of 4

Thread: can we use multiple sql statements in a procedure?

Hybrid View

  1. #1
    Join Date
    Dec 2000
    Posts
    95

    Question

    Hi friends,

    can we use multiple sql statements in a procedure?

    I trued like this

    SQL> create procedure proctab1 (table1 in varchar2,table2 in varchar2)
    2 as
    3 begin
    4 execute immediate
    5 'create table ' || table1 || ' (name varchar2(10))' ,
    6 'create table ' || table2 || ' (name varchar2(10))';
    7 end;
    8 /

    Warning: Procedure created with compilation errors.


    if anybody knows the correct syntax please help me

    regards

    SrinivasM

  2. #2
    Join Date
    Nov 2000
    Location
    greenwich.ct.us
    Posts
    9,092
    No, that has to be in two EXECUTE IMMEDIATE statements.
    execute immediate 'create table ' || table1 || ' (name varchar2(10))';
    execute immediate 'create table ' || table2 || ' (name varchar2(10))';
    Jeff Hunter
    marist89@yahoo.com
    http://marist89.blogspot.com/
    Get Firefox!
    "I pledge to stop eating sharks fin soup and will not do so under any circumstances."

  3. #3
    Join Date
    Dec 2000
    Posts
    95

    Exclamation not working

    Hi Jeff Hunter,

    I tried the way as you said. but even though i am getting copilation errors

    i tried like this

    SQL> create procedure proctab1 (table1 in varchar2,table2 in varchar2)
    2 as
    3 begin
    4 exceute immediate 'create table ' || table1 || ' (name varchar2(10))';
    5 exceute immediate 'create table ' || table2 || ' (name varchar2(10))';
    6 end;
    7 /

    Warning: Procedure created with compilation errors.


    and i tried again like this

    SQL> create procedure proctab1 (table1 in varchar2,table2 in varchar2)
    2 as
    3 begin
    4 exceute immediate 'create table ' || table1 || ' (name varchar2(10))'; ,
    5 exceute immediate 'create table ' || table2 || ' (name varchar2(10))';
    6 end;
    7 /

    Warning: Procedure created with compilation errors.

    help me

    SrinivasM

  4. #4
    Join Date
    Dec 2000
    Posts
    95

    sorry Jeff Hunter its working

    HI Jeff Hunter,

    thank you its working fine

    regards
    SrinivasM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Click Here to Expand Forum to Full Width