Dynamic SQL with pgsql, how to? - Mailing list pgsql-general

From Andre Lopes
Subject Dynamic SQL with pgsql, how to?
Date
Msg-id n2g18f98e681005030144x80e99b9n6155a56c55ce4372@mail.gmail.com
Whole thread Raw
Responses Re: Dynamic SQL with pgsql, how to?  (Jorge Arevalo <jorgearevalo@gis4free.org>)
Re: Dynamic SQL with pgsql, how to?  ("A. Kretschmer" <andreas.kretschmer@schollglas.com>)
List pgsql-general
Hi,

I need to write some dynamic SQL in pgsql.

I have to do something like this:

[code=SQL Server]
    SET @STRINGN = @STRINGN + ' AND A.' + @CAMPOFECINI + ' IN (SELECT MAX(B.' + @CAMPOFECINI + ')
            FROM ' + @TABLA + ' B
            WHERE B.ID_SOCIEDAD = A.ID_SOCIEDAD
            AND B.ID_EMPREGAD = A.ID_EMPREGAD'
    IF @F_ALTA IS NOT NULL
        SET @STRINGN = @STRINGN + ' AND B.DAT_INI_ACT_EMP = A.DAT_INI_ACT_EMP'
    SET @STRINGN = @STRINGN + ')'
       EXEC sp_executesql @STRINGN,
                N'@FINI2 datetime out, @FFIN2 datetime out, @CAMP2 varchar(50) out',
                @FINI out, @FFIN out , @CAMP out
[/code]

There is documentation on how can I do this in pgsql?

Best Regards,

pgsql-general by date:

Previous
From: Carsten Kropf
Date:
Subject: User defined type - analyze problem
Next
From: Jorge Arevalo
Date:
Subject: Re: Dynamic SQL with pgsql, how to?