[SQL] Cursors..

2008-08-18 Thread David Calle
Hi List, I need to convert this cursor of Oracle to Postgres... I wait for your help!! *declare** v_num_dep integer := &v_num_dep; v_cont integer:=0; cursor cursor_dep is select * from hr.employees where hr.employees.department_id = v_num_dep; reg_dep cursor_dep%rowtype; beg

Re: [SQL] Join question

2008-08-18 Thread Oliveiros Cristina
I don't understand your count(total) expression... It doesnt work, because apparently you dont have any "total" column... Apparently, you meant count(color) The problem is that you are grouping by a.org,a.user and on table "a" u actually dont have any "null" users... Well, if it is to include

Re: [SQL] Join question

2008-08-18 Thread Daniel Hernandez
have you tried a right Join?Daniel Hernndez.San Diego, CA."The more you learn, the more you earn".Fax: (808) 442-0427-Original Message-From: "Edward W. Rouse" [EMAIL PROTECTED]: 08/15/2008 09:48 AMTo: [EMAIL PROTECTED]: Re: [SQL] Join question I have 2 tables, both have a us

[SQL] COPY TO with FORCE QUOTE *

2008-08-18 Thread Jackson Pauls
I would like to be able to force quotes on all columns in the COPY TO command without having to name all columns explicitly. E.g.: COPY a TO '/tmp/a.csv' WITH CSV FORCE QUOTE *; Reading the documentation, there doesn't seem to be a way to do this. Am I missing something? If not, could I submit th

Re: [SQL] Select function with set return type

2008-08-18 Thread Andreas Kretschmer
Nacef LABIDI <[EMAIL PROTECTED]> schrieb: > Hi all, > > I am writing some functions with retrun type as a SETOF of a datatype that I > have defined. How can I test them with a select statement. > Doing select my_function(); return set valued function called in context that > cannot accept a set

[SQL] Select function with set return type

2008-08-18 Thread Nacef LABIDI
Hi all, I am writing some functions with retrun type as a SETOF of a datatype that I have defined. How can I test them with a select statement. Doing select my_function(); return set valued function called in context that cannot accept a set Thanks to all Nacef

Re: [SQL] INSERT or UPDATE

2008-08-18 Thread A. Kretschmer
am Mon, dem 18.08.2008, um 9:44:48 +0200 mailte Andreas Kraftl folgendes: > But there is also the possibility, that one row is available. Means that > i need an UPDATE instead of the INSERT. > > Is it in SQL possible to decide if there is an UPDATE or an INSERT or > must i program something with

[SQL] INSERT or UPDATE

2008-08-18 Thread Andreas Kraftl
Hello I have an XML file, which i must import into the database. I transform this XML File with xslt to sql INSERTS. But there is also the possibility, that one row is available. Means that i need an UPDATE instead of the INSERT. Is it in SQL possible to decide if there is an UPDATE or an INSERT