This discussion is archived
1 Reply Latest reply: Dec 14, 2012 12:36 AM by ChrisJenkins RSS

ttisql - execute prepared stmts in script

598001 Newbie
Currently Being Moderated
Hello!
I want increase speed of importing data using ttisql. My script contains about 12k simular MERGEs. Can I prepare this state,ent once and later substitute params from script?
  • 1. Re: ttisql - execute prepared stmts in script
    ChrisJenkins Guru
    Currently Being Moderated
    Yes, that is possible. Just use parameter placeholders in the statement and 'prepare' it in ttIsql. A simpel example:

    Command> prepare 1 update mytab set col1 = :c1val where key1 = :key1val;
    Command> exec 1;


    Type '?' for help on entering parameter values.
    Type '*' to end prompting and abort the command.
    Type '-' to leave the parameter unbound.
    Type '/;' to leave the remaining parameters unbound and execute the command.

    Enter Parameter 1 'COL1VAL' (VARCHAR2) > 'abc';
    Enter Parameter 2 'KEY1VAL' (VARCHAR2) > '1';
    1 row updated.
    Command>

    So in this case your input file for ttIsql would contain:

    prepare 1 update mytab set col1 = :c1val where key1 = :key1val;
    exec 1;
    'abc';
    '1';


    Chris

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points