Results 1 to 2 of 2
  1. #1
    Join Date
    Jul 2005
    Posts
    276

    Unanswered: truncate table in a procedure

    I need to truncate a table in a procedure and then insert data into the table.
    We have a procedure which is used to truncate the table rather than using the TRUNCATE command. I read that, sometimes the truncate table poses a problem when used in a procedure. Is it the same with calling a procedure in the procedure which actually truncates the table?
    And how do I call that procedure? Is it as shown below-

    create proc....
    ..
    begin
    exec truncate_tbl(<tablename>);
    open c1
    loop
    ..
    ..

    Can someone please let me know?
    Thanks in advance.

  2. #2
    Join Date
    Jun 2004
    Location
    Liverpool, NY USA
    Posts
    2,509
    Code:
    create proc....
    ..
    begin
      execute immediate 'truncate table tablename';
      open c1
      loop
    ..
    ..
    end;
    Bill
    You do not need a parachute to skydive. You only need a parachute to skydive twice.

Posting Permissions

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