Thread: SQL-Programmer tool and field%type support
Hi,I'm looking for PL/SQL programmer tool. I wanted to use SQL-Programmer but itdoesn't support Postgres data base.Please can sommeone suggest me an other tool wich can replace this one orexplaine mehow we can use SQLProgrammer with Postgres if it is possible. I have an other question about the use of %type and alias in PL/SQL. So the excution of functions containing varibales of type maytable.field1%type prompts parser errors. error on the creation of the function : create function test (int) returns maytable.field1%type as' ... parser: parse error at or near "." error on the excution of the function : create function test (int) returns int as' declare var1 maytable.field1%type; var2 alias for $1; .... parser: parse error at or near '%' parser: parse error at or near "$1" Please help me.Thanks.Mourad.
On Fri, Oct 05, 2001 at 03:37:14PM +0200, Mourad EL HADJ MIMOUNE wrote: > Hi, > I'm looking for PL/SQL programmer tool. I wanted to use SQL-Programmer but > it > doesn't support Postgres data base. > Please can sommeone suggest me an other tool wich can replace this one or > explaine me how we can use SQLProgrammer with Postgres if it is possible. I don't know such tool.The documentation has some advices on tools/ways to program in PL/pgSQL. > I have an other question about the use of %type and alias in PL/SQL. So the > excution of functions containing varibales of type maytable.field1%type > prompts parser errors. > error on the creation of the function : > create function test (int) returns maytable.field1%type as' ... This syntax is not supported in PG 7.1. AFAIK, it will be supported in PG 7.2.You can use function overloading if you need the same function to return different types.-Roberto -- +----| http://fslc.usu.edu USU Free Software & GNU/Linux Club |------+ Roberto Mello - Computer Science, USU - http://www.brasileiro.net http://www.sdl.usu.edu - Space Dynamics Lab, Developer Information is the greatest weapon of power to the modern wizard.
Mourad, > > I have an other question about the use of %type and alias in > PL/SQL. So the > > excution of functions containing varibales of type > maytable.field1%type > > prompts parser errors. > > error on the creation of the function : > > create function test (int) returns maytable.field1%type as' ... What Roberto is saying is that the declaration: DECLARE v_field1 mytable.field1%type is supported internal to a PL/pgSQL function, but CREATE FUNCTION test1(int) RETURNS mytable.filed1%type is not. This is because the %type declaration is supported in PL/pgSQL, but not in Postgres SQL. -Josh ______AGLIO DATABASE SOLUTIONS___________________________ Josh Berkus Complete informationtechnology josh@agliodbs.com and data management solutions (415) 565-7293 for law firms, small businesses fax 621-2533 and non-profit organizations. San Francisco
"Josh Berkus" <josh@agliodbs.com> writes: > DECLARE > v_field1 mytable.field1%type > is supported internal to a PL/pgSQL function, but > CREATE FUNCTION test1(int) RETURNS mytable.filed1%type > is not. This is because the %type declaration is supported in PL/pgSQL, > but not in Postgres SQL. It does work in 7.2devel, however ... regards, tom lane