Truncation From Unix Script

From: Dan Daley <Dan_Daley%FEDERAL-MOGUL_at_notesgw.CompuServe.com>
Date: 1996/07/16
Message-ID: <4shdgs$pgl_at_arl-news-svc-1.compuserve.com>#1/1


I've been trying to truncate a table using a Unix script with the following stored
 procedure.



  create or replace procedure truncate_table(string in varchar2) as   cursor_a integer;
  ignore integer;
  begin
  cursor_a := dbms_sql.open_cursor;
  dbms_sql.parse(cursor_a, 'truncate table ' ||string,dbms_sql.native);   ignore := dbms_sql.execute(cursor_a);
  dbms_sql.close_cursor(cursor_a);
  end;

This procedure runs fine from a SQLplus prompt but when trying to execute
it from unix using the following script it fails.



  PATH=/usr/bin:/dbdisk01/home/dba/oracle/product/7.1.6/bin:/bin:   PATH=$PATH:.#
  sqlplus sys/password << EOF
  BEGIN
  EXECUTE TRUNCATE_TABLE('shraps.receiving_header');   END;
  /
  EOF

The errors which result are:



  PL/SQL Release 2.1.6.2.0 - Production

  SQL> 2 3 4 EXECUTE TRUNCATE_TABLE('sys.receiving_header');

          *
  ERROR at line 2:
  ORA-06550: line 2, column 9:
  PLS-00103: Encountered the symbol "TRUNCATE_TABLE" when expecting one of the
  following:
  := . ( _at_ % ;
  := was inserted before "TRUNCATE_TABLE" to continue.


Does anyone have any ideas on how to get around this problem?

Dan Daley Received on Tue Jul 16 1996 - 00:00:00 CEST

Original text of this message