Re: Forms 3.0 question

From: Pavel Luzanov <pal_at_bank.kemerovo.su>
Date: Thu, 10 Mar 94 17:04:42 +0700
Message-ID: <199403101707.AA05350_at_odb-gw.bank.kemerovo.su>


mholt_at_srg.srg.af.mil writes:
>
>I'm want to build a .sql script from within a SQL*Forms 3.0 trigger, and
>then I want to execute it. I've included the trigger text below. The indicated
>lines are giving me trouble. As long as the system.last_query select statement
>doesn't have a where clause, everything works fine. The trouble arises when a
>where clause is generated (e.g. where name='jerry'). The single quotation marks
>are screwing things up, since that's the character that groups characters into a
>string. So, if I expanded the string I manufacture below, it would look
>something like this:
>
> 'echo -n select name from table where name='jerry''
>
>As you can see, the extra quotation marks in the where clause are ruining my day. Can anyone see an obvious solution to this problem?
>
> if :system.last_query IS NULL then
> message( 'No query results to print.' );
> bell;
> pause;
> raise form_trigger_failure;
> end if;
> host( 'echo spool print > print.sql', NO_SCREEN );
> ---> buffer := 'echo -n ' || :system.last_query || ' >> print.sql';
> ---> host( buffer, NO_SCREEN );

Try without var 'buffer' :

    host('echo spool print>>print.sql',no_screen);     host('echo '||'"'||:system.last_query||'"'||'>>print.sql',no_screen);

                  ^^^                      ^^^
    host('echo />>print.sql',no_screen);
    host('echo spool off>>print.sql',no_screen);     host('echo exit>>print.sql',no_screen);

Pavel Luzanov. Received on Thu Mar 10 1994 - 11:04:42 CET

Original text of this message