Re: [SQL] sql function

2005-10-14 Thread Andreas Kretschmer
Shavonne Marietta Wijesinghe <[EMAIL PROTECTED]> schrieb: > I have 2 schemas "operativo" and "autore" and they both have a table "PECDT00" > > i want to create a function with the following sql command (using the > programme > pgadmin 3) in pgadmin 3 there is a small wizard to fill when u creat

Re: [SQL] sql function: using set as argument

2005-09-05 Thread Akshay Mathur
Found a solution   Second function can be written as     Get_count(anyarray, int)     Select count(b_column) from some_table where some_field_1 any ($1) and some_field_2 = $2;   Calling this function:     Select Get_count(array(functio

Re: [SQL] sql function: using set as argument

2005-08-18 Thread Akshay Mathur
st 16, 2005 3:39 AM To: Akshay Mathur Cc: pgsql-sql@postgresql.org Subject: Re: [SQL] sql function: using set as argument   Is there a reason not to build it in as a sub-query?   E.g., if you have a function get_count( int ):   SELECT count(b_column) FROM some_table

Re: [SQL] sql function: using set as argument

2005-08-15 Thread Thomas F. O'Connell
Is there a reason not to build it in as a sub-query?E.g., if you have a function get_count( int ): SELECT count(b_column)FROM some_tableWHERE some_field_1 in (    SELECT a_column    FROM a_table    WHERE some_condition)AND some_field_2 = $2; --Thomas F. O'ConnellCo-Founder, Information ArchitectSit

Re: [SQL] SQL function to validate money input

2003-10-16 Thread Richard Huxton
On Wednesday 15 October 2003 22:46, Zhao, Scott wrote: > Hi All, > > Is there a function available to validate if the input is a correct > money format? For exapmle, "23.56" is a correct number but "23.567" is > incorrect. I just like to do this in postgres level not in my > application code. Well

Re: [SQL] SQL function parse error ?

2003-01-10 Thread Tom Lane
Robert Treat <[EMAIL PROTECTED]> writes: > ... I still > would like to see answered is whether oracle or others support >$ as an > operator, or if the sql spec has anything to say on the matter. The SQL spec does not have the concept of user-definable operators at all, so it provides no useful gu

Re: [SQL] SQL function parse error ?

2003-01-10 Thread Robert Treat
On Fri, 2003-01-10 at 04:13, Radu-Adrian Popescu wrote: > > Robert, my dear fellow... > > How about checking your facts before contradicting anyone ? Shame on you ! > Have you actually tried to do a SELECT* from foo ? Pathetic ! At least you started out all nice and flowery... > Try it out, if

Re: [SQL] SQL function parse error ?

2003-01-10 Thread Radu-Adrian Popescu
obert Treat" <[EMAIL PROTECTED]> To: "Radu-Adrian Popescu" <[EMAIL PROTECTED]> Cc: "Achilleus Mantzios" <[EMAIL PROTECTED]>; "Tom Lane" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Thursday, January 09, 2003 10:44 PM Subject: Re: [SQL]

Re: [SQL] SQL function parse error ?

2003-01-09 Thread Robert Treat
On Thu, 2003-01-09 at 11:29, Radu-Adrian Popescu wrote: > What i'm saying is that i know that some of my colleagues, nice guys for > that matter, and good programmers, will come screaming > to me "what's with the b.s. error ?!?", and when i'll tell them that the sql > parser belives that's an inexi

Re: [SQL] SQL function parse error ?

2003-01-09 Thread Radu-Adrian Popescu
Nice to see that things are starting to move. I was wandering however whether I've succeeded in making a point. Regards, = Radu-Adrian Popescu CSA, DBA, Developer Aldratech Ltd. - Original Message - From: "Tom Lane" <[EMAIL PROTECTED]> Subject: Re: [SQL] SQL

Re: [SQL] SQL function parse error ?

2003-01-09 Thread Tom Lane
Stephan Szabo <[EMAIL PROTECTED]> writes: > Although the rules could be similar to those for + and - at the end of > operator strings (no $ at the end of an operator unless it contains > characters not normally in SQL92 operators). I'm not sure that > behavior is sensible either, but if someone wa

Re: [SQL] SQL function parse error ?

2003-01-09 Thread Stephan Szabo
On Thu, 9 Jan 2003, Tom Lane wrote: > Achilleus Mantzios <[EMAIL PROTECTED]> writes: > > On Thu, 9 Jan 2003, Radu-Adrian Popescu wrote: > >> Why is that ? Because the >$ does not exist, not in the default operator > >> list > > > i think the parser is built with yacc, (not "from scratch code") so

Re: [SQL] SQL function parse error ?

2003-01-09 Thread Radu-Adrian Popescu
ELECT * is the same as SELECT *. I rest my case. Cheers, = Radu-Adrian Popescu CSA, DBA, Developer Aldratech Ltd. - Original Message - From: "Tom Lane" <[EMAIL PROTECTED]> To: "Achilleus Mantzios" <[EMAIL PROTECTED]> Cc: "Radu-Adrian Popescu" <

Re: [SQL] SQL function parse error ?

2003-01-09 Thread Tom Lane
Achilleus Mantzios <[EMAIL PROTECTED]> writes: > On Thu, 9 Jan 2003, Radu-Adrian Popescu wrote: >> Why is that ? Because the >$ does not exist, not in the default operator >> list > i think the parser is built with yacc, (not "from scratch code") so > maybe finding if ">$" is in the specific DB's

Re: [SQL] SQL function parse error ?

2003-01-09 Thread Stephan Szabo
On Thu, 9 Jan 2003, Radu-Adrian Popescu wrote: > Since you can overload and define new operators, the parser must - at some > point in time - lookup the operator definition. > It seems to me (but this is just an ideea), that the rules should go like > this : > ... > check >$ is a defined operator

Re: [SQL] SQL function parse error ?

2003-01-09 Thread Radu-Adrian Popescu
Mantzios" <[EMAIL PROTECTED]> To: "Radu-Adrian Popescu" <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Thursday, January 09, 2003 9:29 PM Subject: Re: [SQL] SQL function parse error ? On Thu, 9 Jan 2003, Radu-Adrian Popescu wrote: > > > Why is that ? B

Re: [SQL] SQL function parse error ?

2003-01-09 Thread Radu-Adrian Popescu
<[EMAIL PROTECTED]> To: "Radu-Adrian Popescu" <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Thursday, January 09, 2003 4:48 PM Subject: Re: [SQL] SQL function parse error ? "Radu-Adrian Popescu" <[EMAIL PROTECTED]> writes: > This is SQL, and pe

Re: [SQL] SQL function parse error ?

2003-01-09 Thread Achilleus Mantzios
On Thu, 9 Jan 2003, Radu-Adrian Popescu wrote: > > > Why is that ? Because the >$ does not exist, not in the default operator > list (also there is no operator defined > using $ anywhere within). And because whitespacing the code solves the > problem, which is rather thin, i must say. > Radu-Adri

Re: [SQL] SQL function parse error ?

2003-01-09 Thread Radu-Adrian Popescu
p clear this issue. Cheers, = Radu-Adrian Popescu CSA, DBA, Developer Aldratech Ltd. - Original Message - From: "Tomasz Myrta" <[EMAIL PROTECTED]> To: "Radu-Adrian Popescu" <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Thursday, January 09, 2003 3:22

Re: [SQL] SQL function parse error ?

2003-01-09 Thread Tom Lane
"Radu-Adrian Popescu" <[EMAIL PROTECTED]> writes: > This is SQL, and people who are using PostgreSql write SQL, not > whitespace-sensitive SQL, bash or whatever. Nonsense. SQL syntax is space-sensitive. Or have you successfully written SELECTXFROMY; lately? There has occasionally been t

Re: [SQL] SQL function parse error ?

2003-01-09 Thread Tomasz Myrta
Radu-Adrian Popescu wrote: I'm perfectly aware of the fact that a space solves the issue here. What I'm saying is that it is not natural nor common to take some whitespace into account when parsing, since this is not bash language, nor python, as it shouldn't be ! This is SQL, and people who ar

Re: [SQL] SQL function parse error ?

2003-01-09 Thread Radu-Adrian Popescu
<[EMAIL PROTECTED]> To: "Radu-Adrian Popescu" <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Thursday, January 09, 2003 1:56 PM Subject: Re: [SQL] SQL function parse error ? Radu-Adrian Popescu wrote: > > Take the following for example: > create or replace f

Re: [SQL] SQL function parse error ?

2003-01-09 Thread Tomasz Myrta
Radu-Adrian Popescu wrote: Take the following for example: create or replace function testfunc1(int) returns setof test as ' select * from test where age>$1; '^^ language sql; I didn't find it in documentation, but sql functions are like bash (you forgot ab

Re: [SQL] SQL function triggers

2002-10-15 Thread Jan Wieck
Brian Blaha wrote: > > I would like to write a function as a set of SQL statements, and then > use that function > in a trigger. However, since triggers require a return type of opaque, > and SQL functions > cannot return type opaque, this doesn't look possible. Am I missing > something? The SQL

Re: [SQL] SQL function triggers

2002-10-15 Thread Tom Lane
Brian Blaha <[EMAIL PROTECTED]> writes: > I would like to write a function as a set of SQL statements, and then > use that function > in a trigger. However, since triggers require a return type of opaque, > and SQL functions > cannot return type opaque, this doesn't look possible. You could cal

Re: [SQL] sql function examples requested (! select)

2002-08-14 Thread Tom Lane
Sue Humphrey <[EMAIL PROTECTED]> writes: > I would like examples of functions using update, insert and > delete, where LANGUAGE 'SQL', both how to write them and how to > use them. Have you read the documentation? http://www.ca.postgresql.org/users-lounge/docs/7.2/postgres/xfunc-sql.html The fi

Re: [SQL] SQL FUNCTION return type on INSERT

2001-11-03 Thread Josh Berkus
Eddy, > What value should I RETURN for a SQL FUNCTION that contains an INSERT > statement? OPAQUE. -Josh __AGLIO DATABASE SOLUTIONS___ Josh Berkus Complete information technology [EMAIL PROTECTED] and data management

Re: [SQL] SQL FUNCTION return type on INSERT

2001-11-03 Thread Edward Grabczewski
I've just looked at the new online 7.2 documentation and found that all functions must end in some kind of select. How about this then? CREATE FUNCTION foo(varchar) RETURN unknown AS ' INSERT INTO footable VALUES ($1); SELECT null; ' LANGUAGE 'sql'; "Edward Grabczewski" <[EMAIL PROTE