Results 1 to 2 of 2
  1. #1
    Join Date
    Feb 2003
    Location
    Portugal
    Posts
    21

    Question Unanswered: dynamic queries??

    hello!

    I am trying to run the following query:

    strSelectString := ''SELECT OBJID2 as strPersonnummer FROM '' || strRollentab || '' where qualitaet = ''|| referrer_keys.QUALITAETNR ||''
    AND OBJID2 = '' || NEW.ID || '''';

    I have tried (with adn withou quote_literal):
    EXECUTE ''SELECT OBJID2 as strPersonnummer FROM '' || strRollentab || '' where qualitaet = ''|| quote_literal(QUALITAETNR) ||'' AND OBJID2 = '' || NEW.ID || '''';

    and..:
    FOR ROW IN EXECUTE strSelectString LOOP
    Raise NOTICE ''result: % '',strPersonnummer;
    END LOOP;
    RAISE NOTICE ''String is.: %'',strSelectString;

    but no luck. The latest error message I get is: misssing .. at end of sql expression..

    Can anyone help?? Pleeeze?

    thanks!

  2. #2
    Join Date
    Sep 2001
    Location
    Vienna
    Posts
    400

    problem

    strange queries you have here

    maybe the || at the end of the query
    this not needed

    || NEW.ID '';
    http://www.postgresql.org
    --Postgresql is the only kind of thing--

Posting Permissions

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