Re: Beginner - Help for pgsql 8.0.3 win32 platform

From: Michael Fuhr <mike(at)fuhr(dot)org>
To: Nugroho Laison <nugon19(at)yahoo(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Beginner - Help for pgsql 8.0.3 win32 platform
Date: 2005-08-20 15:46:56
Message-ID: 20050820154655.GA61044@winnie.fuhr.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Fri, Aug 19, 2005 at 03:01:38PM -0700, Nugroho Laison wrote:
> = how to get raise notice messages at client database
> API such as ODBC, ADO, DAO, RDO or client programming
> such as PHP, JSP, C/C++, Java?

You'll have to consult the interface's documentation. For example,
for C see the "libpq - C Library" chapter in the PostgreSQL
documentation:

http://www.postgresql.org/docs/8.0/static/libpq.html
http://www.postgresql.org/docs/8.0/static/libpq-notice-processing.html

> = how to get number of affected rows by last sql
> statement/operation (using GET DIAGNOSTICS statement)?

For server-side PL/pgSQL programming see "Obtaining the Result
Status" in the PL/pgSQL documentation:

http://www.postgresql.org/docs/8.0/static/plpgsql-statements.html#PLPGSQL-STATEMENTS-DIAGNOSTICS

For client-side C code, see "Retrieving Query Result Information"
and "Retrieving Result Information for Other Commands" in the libpq
documentation:

http://www.postgresql.org/docs/8.0/static/libpq-exec.html#LIBPQ-EXEC-SELECT-INFO
http://www.postgresql.org/docs/8.0/static/libpq-exec.html#LIBPQ-EXEC-NONSELECT

For other interfaces, see the relevant documentation.

> = how to use PERFORM statement?

See "Executing an Expression or Query With No Result" in the PL/pgSQL
documentation:

http://www.postgresql.org/docs/8.0/static/plpgsql-statements.html#PLPGSQL-STATEMENTS-PERFORM

> = how to use EXECUTE statement?

EXECUTE means different things depending on whether you're using
PL/pgSQL or SQL. See the documentation for examples:

http://www.postgresql.org/docs/8.0/static/plpgsql-statements.html#PLPGSQL-STATEMENTS-EXECUTING-DYN
http://www.postgresql.org/docs/8.0/static/sql-execute.html

> = is it true that must state/write
> <EXCEPTION_CONDITION_NAME> (e.g. division_by_zero ,
> error_in_assignment, etc) where we using EXCEPTION?
> can we use custom logical error condition (e.g.
> (my_Var = 0), (rec_count > 0), (gender = 'M'),
> (sqlstate <> 0 --> error system variable), etc)

See "Trapping Errors" in the PL/pgSQL documentation for the allowed
usage:

http://www.postgresql.org/docs/8.0/static/plpgsql-control-structures.html#PLPGSQL-ERROR-TRAPPING

> = is there any virtual object that we can access to
> examine new inserted or old deleted record in trigger
> for statement (such as old and new in trigger for
> row)?

See "Trigger Procedures" in the PL/pgSQL documentation or the
documentation for whatever server-side language you're using.

http://www.postgresql.org/docs/8.0/static/plpgsql-trigger.html

> = can we create disconnected cursor?
> (e.g.
>
> declare
> v_cursor1 refcursor;
> v_cursor2 refcursor;
>
> ...
> ...
> open v_cursor1;
> v_cursor2 := v_cursor1;
> close v_cursor1;
> fetch v_cursor2;

See "Cursors" in the PL/pgSQL documentation for the allowed usage:

http://www.postgresql.org/docs/8.0/static/plpgsql-cursors.html

If the documentation doesn't answer your questions, then please
post specific examples of what you're trying to do and describe the
difficulties you're having.

--
Michael Fuhr

In response to

Browse pgsql-general by date

  From Date Subject
Next Message CSN 2005-08-20 22:33:01 selecting rows older than X, ensuring index is used
Previous Message Michael Fuhr 2005-08-20 14:48:15 Re: Postgresql Function Language question