From: | Jeff Eckermann <jeff(at)akira(dot)eckermann(dot)com> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | Help with SQL Function |
Date: | 2001-01-04 11:15:50 |
Message-ID: | 200101041115.LAA28896@akira.eckermann.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
I sent this message yesterday, but it doesn't appear to have made it to the list.
Apologies to anyone who receives it twice.
I'm falling at the first hurdle. Can someone tell me how to pass an attribute value into a function, as I'm trying to do below? I've studied the docs every which way, but can't seem to find the cause of my problem.
Thanks in advance for ignorance relief.
extracts=# create function testfunc(text) returns int4 as '
extracts'# select count (*) from dedcolo where equip_type = ''$1'' --- That's doubled single quotes
extracts'# ' language 'sql';
CREATE
extracts=# select testfunc('Dialup');
testfunc
----------
0
(1 row)
extracts=# create function testfunc() returns int4 as '
extracts'# select count (*) from dedcolo where equip_type = ''Dialup'' --- Doubled single quotes, again
extracts'# ' language 'sql';
CREATE
extracts=# select testfunc();
testfunc
----------
3453
(1 row)
From | Date | Subject | |
---|---|---|---|
Next Message | Jeff Davis | 2001-01-04 12:33:49 | Restriction of database size |
Previous Message | Marc SCHAEFER | 2001-01-04 11:07:37 | libpq-fe: how to determine unique collision ? |