Results 1 to 7 of 7

Thread: pl/sql (simple)

  1. #1
    Join Date
    Aug 2005
    Location
    Kuala Lumpur, MY
    Posts
    108

    Unanswered: pl/sql (simple)

    hie all

    im trying to truncate a few table at once using pl/sql

    this is the way i tried but it returns some error...
    any help

    BEGIN
    truncate table trap_stage_vca_sc_p;
    truncate table trap_ra_vca_sc_p;
    truncate table trap_stage_vca_sc_w;
    truncate_table trap_ra_vca_sc_w;
    truncate table trap_stage_vca_softpin_p;
    truncate table trap_ra_vca_softpin_p;
    truncate table trap_stage_vca_softpin_w;
    truncate table trap_ra_vca_softpin_w;
    truncate table trap_stage_vca_sc_pins_w;
    truncate table trap_ra_vca_sc_pins_w;
    truncate table trap_stage_vca_sc_pins_v;
    truncate table trap_ra_vca_sc_pins_v;
    truncate table trap_stage_vca_all_v;
    truncate table trap_ra_vca_all_v;
    truncate table trap_stage_vca_all_u;
    truncate table trap_ra_vca_all_u;
    truncate table trap_stage_vca_all_b;
    truncate table trap_ra_vca_all_b;
    END;
    /

  2. #2
    Join Date
    Aug 2003
    Location
    Where the Surf Meets the Turf @Del Mar, CA
    Posts
    7,776
    Provided Answers: 1
    eliminate the BEGIN & END statements
    You can lead some folks to knowledge, but you can not make them think.
    The average person thinks he's above average!
    For most folks, they don't know, what they don't know.
    Good judgement comes from experience. Experience comes from bad judgement.

  3. #3
    Join Date
    Aug 2005
    Location
    Kuala Lumpur, MY
    Posts
    108
    u mean ?

    truncate table trap_stage_vca_sc_p;
    truncate table trap_ra_vca_sc_p;
    truncate table trap_stage_vca_sc_w;
    truncate_table trap_ra_vca_sc_w;
    truncate table trap_stage_vca_softpin_p;
    truncate table trap_ra_vca_softpin_p;
    truncate table trap_stage_vca_softpin_w;
    truncate table trap_ra_vca_softpin_w;
    truncate table trap_stage_vca_sc_pins_w;
    truncate table trap_ra_vca_sc_pins_w;
    truncate table trap_stage_vca_sc_pins_v;
    truncate table trap_ra_vca_sc_pins_v;
    truncate table trap_stage_vca_all_v;
    truncate table trap_ra_vca_all_v;
    truncate table trap_stage_vca_all_u;
    truncate table trap_ra_vca_all_u;
    truncate table trap_stage_vca_all_b;
    truncate table trap_ra_vca_all_b;
    /

    it says invalid character....

  4. #4
    Join Date
    Jan 2004
    Posts
    370
    Or use execute immediate

    You know where to look

  5. #5
    Join Date
    Aug 2005
    Location
    Kuala Lumpur, MY
    Posts
    108
    but i need to cron this script in unix... so i need it working as in "code" CANT USE ANY AUTOMATED SOFTWARE PRODUCT

  6. #6
    Join Date
    Jan 2004
    Posts
    370
    truncate is ddl so you must use execute immediate within a pl/sql block.

    This is a good starting point.

    http://www.jlcomp.demon.co.uk/faq/plsql_ddl.html

    You'll find the rest in the docs.

    .

  7. #7
    Join Date
    Aug 2005
    Location
    Kuala Lumpur, MY
    Posts
    108
    skywriter,
    this is a superb page for this questions...
    thanks a lot...

Posting Permissions

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