There is no internal dual table in PG unlike Ora:) If you need to
invoke non-set-returning function simply execute:
SELECT my_func(p1, p2...);
--
Best regards, Yuri.
--
Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
To make changes to your subscription:
If you use intarray type it is convenient to call buil-in intarray
functions for your purpose.
http://www.postgresql.org/docs/8.3/static/intarray.html
SELECT t.a[1] AS min, t.a[array_upper(t.a, 1)] AS max
FROM (SELECT sort(string_to_array('2,3,4,15,6,7',',')::int[]) AS a)t;
--
Best regards,
Take a look at
http://www.postgresql.org/docs/8.3/interactive/plpgsql-cursors.html
and you'll find answer you need.
I need to convert this cursor of Oracle to Postgres...
I wait for your help!!
--
Best regards, Yuri.
--
Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
To make
The function to treate tables is:
CREATE OR REPLACE FUNCTION cr_tbls_by_staid() RETURNS INTEGER AS
$$
DECLARE
stid INTEGER;
q TEXT;
BEGIN
FOR stid IN SELECT staid FROM mytest LOOP
q:= 'CREATE TABLE s' || staid || ' (staid varchar(50), val real,
dt date);'
RAISE NOTICE 'query is: %',
Oh, I checked the function. There are some syntax errors. Right code
listed below:
CREATE OR REPLACE FUNCTION cr_tbls_by_staid() RETURNS INTEGER AS
$$
DECLARE
stid INTEGER;
q TEXT;
BEGIN
FOR stid IN SELECT staid FROM mytest LOOP
q:= 'CREATE TABLE s' || staid || ' (staid varchar(50), val
Hello, Picavet.
Anybody for a ray of light on a different approach ? This look like a
recurrent problem, isn't there an experienced sql programmer here who
tackled this issued a couple of time ?
Actually, I'm not very experienced in SQL. But from my point of view
this problem could be solved
I would like to get effect of selecting table record when construct a
composite type.
CREATE TYPE chains.foo AS (
id INTEGER,
bar INTEGER
);
CREATE OR REPLACE FUNCTION construct_foo(INTEGER,INTEGER) RETURNS
chains.foo AS $$
DECLARE
f chains.foo;
BEGIN
f.id := $1;
f.bar := $2;
RETURN f;
I have following table:
CREATE TABLE t1 (
name VARCHAR(500) NOT NULL,
lid INTEGER NOT NULL,
accs VARCHAR(20)[] NOT NULL
CONSTRAINT t1_lid_key UNIQUE(lid)
);
I interested in the possibility to speed-up search for rows like this:
SELECT lid
FROM t1
WHERE accs
The error sounds suspiciously like what would happen if you tried to
use RETURN QUERY in a pre-8.3 version.
regards, tom lane
Thanks a lot to all. Actually there were a mass of errors in my
function. Now I rewrite it so as it works. It would be much more
complicated
Here is my function:
CREATE OR REPLACE FUNCTION hg18.get_genomeseq (_chr varchar,
_byblocks boolean, _starts integer [], _ends integer []) RETURNS SETOF
text AS
$body$
DECLARE
_startinteger;
_end integer;
_sequence text[];
_seq50RECORD;
_seq text;
I'm trying to automate import data using CORY FROM. For this purpose I
wrote plpgsql function. As my postgres works on windows vista I need
to use E'' syntax for path-to-file. This syntax works fine in SQL
queries like:
COPY table FROM E'path_to_file_with_double_backslashes';
Following query
11 matches
Mail list logo