Thursday, July 23, 2009

Basic PostgreSQL Must-Know's

1. String concatenation using the PL/pgSQL language is done like this:

declare
split_table_name text[];
v_PK text;
v_Query text;

v_Query := 'select ' || v_PK || ' from ' || split_table_name[1];


2. To run the above query string variable (i.e v_Query), use the EXECUTE statement like this:

declare
result text;

EXECUTE v_Query into max_num_str ;

or

EXECUTE 'select ' || v_PK || ' from ' || split_table_name[1] into max_num_str ;

No comments:

Post a Comment

Thank you for your comment.