IF NOT EXIST

From: Igor Korot <ikorot01(at)gmail(dot)com>
To: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: IF NOT EXIST
Date: 2018-12-18 06:10:48
Message-ID: CA+FnnTyg6BZ0u+CCddbJLZoHF3HHSEvEt1xvWHF3b+jqPduEhg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi, ALL,
I have a following statement:

IF NOT EXIST( SELECT 1 SELECT 1 FROM pg_proc AS proc, pg_namespace AS
ns ) CREATE FUNCTION();

Unfortunately trying to execute it thru the ODBC interface with:

ret = SQLExecDirect( m_hstmt, query, SQL_NTS );

gives syntax error near IF.

What is the proper way to do that?

Thank you.

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Pavel Stehule 2018-12-18 06:40:32 Re: IF NOT EXIST
Previous Message s400t 2018-12-18 05:49:01 Re: Creating 2D arrays for pg_copy_from, reading tab-delimited text file that contains comma and double quotes