Re: Starting with pl/pgsql..
От | Terry Yapt |
---|---|
Тема | Re: Starting with pl/pgsql.. |
Дата | |
Msg-id | 3D26F40E.8D3C8AEB@technovell.com обсуждение исходный текст |
Ответ на | Re: Starting with pl/pgsql.. (Josh Jore <josh@greentechnologist.org>) |
Ответы |
Re: Starting with pl/pgsql..
(Josh Jore <josh@greentechnologist.org>)
|
Список | pgsql-novice |
Hi Josh, > Ok so I don't know a thing about Oracle. If you didn't already notice them > there are multiple docs on techdocs.postgresql.org on porting from oracle. Thanks, I have read all of them (I think so)... > Now your function: > > > Table "pepe" > > Column | Type | Modifiers > > --------+-----------------------+----------- > > a | numeric(2,0) | not null > > b | character varying(50) | > > > -- Function: x(int4, int4) > > CREATE FUNCTION "x"("int4", "int4") RETURNS "int4" AS ' DECLARE > > You may want to avoid the use to double-quoting your identifiers. Without > the quotes PostgreSQL will fold the case to the default lower case and > you're restricted to single word identifiers. With quotes you can go and > create identifiers like "BiCap" or even "multiple words". I'll just define > that as a problem waiting to happen. I wouldn't go there unless you had > some real reason to force case sensitivity. I have never put double-quoting in any table, identifier or so. But I have copy/paste from pgadmin II and it put there thatquotes. > > inicio alias for $1; > > final alias for $2; > > -- > > texto varchar; > > BEGIN > > FOR X IN inicio..final LOOP > > texto := "ESTE ES: " || X; > > Again double quotes. Substitute single quotes instead. Use double quotes > for identifiers and single quotes for identifiers. You are already in a > single-quoted section so quote the single quote ala: > > texto := ''ESTE ES: '' || X; > I have substitute my double-quotes with single quotes and here the results: -*- It runs fine from pgadmin. -*- It runs fine from psql (linux system). But, I wants to test inserting more rows and then I have re-created (drop and create) table 'pepe' varying column 'a' fromnumeric(2) to numeric(8), in this way: ============= Table "pepe" Column | Type | Modifiers --------+-----------------------+----------- a | numeric(8,0) | not null b | character varying(50) | Primary key: pepe_pkey ============= Then If I call the function from 'psql' it give me this error (but with pgadmin 2 the same 'select x(10,40) runs fine): NOTICE: Error occurred while executing PL/pgSQL function x NOTICE: line 9 at SQL statement ERROR: Relation 16651 does not exist Thanks....
В списке pgsql-novice по дате отправления: