[SQL] Postgresql function with temporary tables

2012-03-26 Thread Rehan Saleem
hi everyone , i have converted a ms-sql store procedure into PostgreSQL function , but my PostgreSQL function is not giving the same output as my ms-sql procedure does, in this ms-sql store procedure putting the result of 2 queries in two temporary tables and displaying those column values which

Re: [SQL] Postgresql function which compares values from both tables

2012-03-19 Thread Jayadevan M
Hi, > To: pgsql-sql@postgresql.org > Subject: [SQL] Postgresql function which compares values from both tables > > hi , > how to write a function which should read data from 2 tables having > same number of columns and should show the common values from those tables. If you w

Re: [SQL] Postgresql function which compares values from both tables

2012-03-19 Thread David Johnston
> -Original Message- > From: pgsql-sql-ow...@postgresql.org [mailto:pgsql-sql- > ow...@postgresql.org] On Behalf Of Richard Huxton > Sent: Monday, March 19, 2012 4:59 PM > To: David Johnston > Cc: 'Rehan Saleem'; pgsql-sql@postgresql.org > Subject: Re:

Re: [SQL] Postgresql function which compares values from both tables

2012-03-19 Thread Richard Huxton
On 19/03/12 20:04, David Johnston wrote: You would need to install the “HSTORE” extension to convert the record into a key->value pair then perform the comparison on that. No, you can do this just fine with a simple join. BEGIN; CREATE TABLE ta (id int PRIMARY KEY, d date, t text); CREATE TAB

Re: [SQL] Postgresql function which compares values from both tables

2012-03-19 Thread David Johnston
PM To: pgsql-sql@postgresql.org Subject: [SQL] Postgresql function which compares values from both tables hi , how to write a function which should read data from 2 tables having same number of columns and should show the common values from those tables. thanks

[SQL] Postgresql function which compares values from both tables

2012-03-19 Thread Rehan Saleem
hi , how to write a function which should read data from 2 tables having same number of columns and should show the common values from those tables. thanks

Re: [SQL] PostgreSQL Function

2012-01-18 Thread Pavel Stehule
Hello 2012/1/18 Rehan Saleem > hi > i want to create a function in postgresql that take input for columns from > user for example first_name , last_name, addres. and will put them into > table , and i also want to use exception if user enters wrong data. will > some one help me how can i create

[SQL] PostgreSQL Function

2012-01-18 Thread Rehan Saleem
hi  i want to create a function in postgresql that take input for columns from user for example first_name , last_name, addres. and will put them into table , and i also want to use exception if user enters wrong data. will some one help me how can i create thats function , because i am new to p

[SQL] Postgresql Function

2012-01-18 Thread Rehan Saleem
hi  i want to create a function in postgresql that take input for columns from user for example first_name , last_name, addres. and will put them into table , and i also want to use exception if user enters wrong data. will some one help me how can i create thats function , because i am new to p

Re: [SQL] PostgreSQL Function: how to know the number of the returned results of the Query

2009-09-02 Thread Harun Bolat
--- Original Message - From: "bilal ghayyad" To: Sent: Tuesday, September 01, 2009 3:53 AM Subject: [SQL] PostgreSQL Function: how to know the number of the returned results of the Query Hi List; I am building a function in the SQL (PostgreSQL), so I will be able to call this

Re: [SQL] PostgreSQL Function: how to know the number of the returned results of the Query

2009-08-31 Thread Pavel Stehule
Hello look on PERFORM and GET DIAGNOSTICS statements http://www.postgresql.org/docs/8.2/static/plpgsql-statements.html#PLPGSQL-STATEMENTS-SQL-NORESULT http://www.postgresql.org/docs/8.2/static/plpgsql-statements.html#PLPGSQL-STATEMENTS-DIAGNOSTICS regards Pavel Stehule 2009/9/1 bilal ghayyad :

[SQL] PostgreSQL Function: how to know the number of the returned results of the Query

2009-08-31 Thread bilal ghayyad
Hi List; I am building a function in the SQL (PostgreSQL), so I will be able to call this function using a SELECT query. Inside the body of this function, I was need to do the following but not able to know how: I have a SELECT statement (inside the function script itself), and I need to know

Re: [SQL] postgresql function not accepting null valuesinselect statement

2008-02-25 Thread Bart Degryse
ary 22, 2008 10:01 PM To: pgsql-sql@postgresql.org Subject: Re: [SQL] postgresql function not accepting null values inselect statement On Friday 22 February 2008 01:35:47 am Bart Degryse wrote: > Can you try this... > > CREATE OR REPLACE FUNCTION getfunctionaries(p_statecd integer) > RE

Re: [SQL] postgresql function not accepting null values inselect statement

2008-02-24 Thread Robins Tharakan
ED] [mailto: > > [EMAIL PROTECTED] > > On Behalf Of johnf > > Sent: Friday, February 22, 2008 10:01 PM > > To: pgsql-sql@postgresql.org > > Subject: Re: [SQL] postgresql function not accepting null values > > inselect > > statement > > >

Re: [SQL] postgresql function not accepting null values inselect statement

2008-02-24 Thread Robins Tharakan
http://www.postgresql.org/docs/current/static/functions-comparison.html This document states this: Lets assume: A = NULL B = 10 C = NULL SELECT 1 WHERE A = B returns no rows SELECT 1 WHERE A = C returns no rows (even though both A and C are NULL) SELECT 1 WHERE A IS NOT DISTINCT FROM C returns 1

Re: [SQL] postgresql function not accepting null values inselect statement

2008-02-24 Thread Jyoti Seth
gresql.org Subject: Re: [SQL] postgresql function not accepting null values inselect statement On Friday 22 February 2008 01:35:47 am Bart Degryse wrote: > Can you try this... > > CREATE OR REPLACE FUNCTION getfunctionaries(p_statecd integer) > RETURNS SETOF t_functionaries AS >

Re: [SQL] postgresql function not accepting null values inselect statement

2008-02-22 Thread johnf
On Friday 22 February 2008 01:35:47 am Bart Degryse wrote: > Can you try this... > > CREATE OR REPLACE FUNCTION getfunctionaries(p_statecd integer) > RETURNS SETOF t_functionaries AS > $BODY$ > DECLARE > rec t_functionaries%ROWTYPE; > BEGIN > FOR rec IN ( > SELECT f.functionaryid, f.categ

Re: [SQL] postgresql function not accepting null values inselect statement

2008-02-22 Thread Bart Degryse
nt separately it gives values Thanks, Jyoti -Original Message- From: Richard Huxton [mailto:[EMAIL PROTECTED] Sent: Friday, February 22, 2008 2:35 PM To: Jyoti Seth Cc: pgsql-sql@postgresql.org Subject: Re: [SQL] postgresql function not accepting null values in select statement Jyoti Seth wrot

Re: [SQL] postgresql function not accepting null values in select statement

2008-02-22 Thread Richard Huxton
Jyoti Seth wrote: Hi, I have a the following procedure CREATE OR REPLACE FUNCTION getfunctionaries(p_statecd integer) SELECT f.functionaryid, f.category,f.description FROM functionaries f where f.statecd=p_statecd In the functionaries table statecd is a null field.

Re: [SQL] postgresql function not accepting null values in select statement

2008-02-22 Thread Robins Tharakan
quot; > > As the document suggests you may want to try this way out: > > WHERE f.statecd IS NOT DISTINCT FROM p_statecd > > This would take care of both NULL and non-NULL values. > > *Robins* > > > -- Forwarded message -- > From: Jyoti Seth &l

Re: [SQL] postgresql function not accepting null values in select statement

2008-02-22 Thread Jyoti Seth
@postgresql.org Subject: Re: [SQL] postgresql function not accepting null values in select statement Jyoti Seth wrote: > > If I pass null value as the parameter of postgresql function, which is used > in the where clause of select statement is not functioning properly. Either: 1. You'r

Re: [SQL] postgresql function not accepting null values in select statement

2008-02-22 Thread Richard Huxton
Jyoti Seth wrote: If I pass null value as the parameter of postgresql function, which is used in the where clause of select statement is not functioning properly. Either: 1. You're talking about frooble(), in which case it's supposed to do that. or 2. You'll need to tell us what function it

[SQL] postgresql function not accepting null values in select statement

2008-02-22 Thread Jyoti Seth
Hi, If I pass null value as the parameter of postgresql function, which is used in the where clause of select statement is not functioning properly. I have also changed the value of transform_null_equals = on in the conf file and restarted postgresql. But it is still giving error. Is t