Re: [GENERAL] query ... returned 4 columns

2007-03-12 Thread Sorin Schwimmer
I am running 8.1.4 and the o.* notation works. Thanks again, Sorin Need Mail bonding? Go to the Yahoo! Mail Q&A for great tips from Yahoo! Answers users. http://answers.yahoo.com/dir/?link=list&sid=396546091

Re: [GENERAL] query ... returned 4 columns

2007-03-09 Thread Tom Lane
Sorin Schwimmer <[EMAIL PROTECTED]> writes: > Having the same structure, I put > INSERT INTO archive.expected_stuff VALUES(o); > but it doesn't work. Instead, I had to rewrite as > INSERT ... VALUES (o.source,o.warehouse...); Of course. The former command implies that you are inserting a composit

Re: [GENERAL] query ... returned 4 columns

2007-03-09 Thread Sorin Schwimmer
Thank you, indeed SELECT * INTO o ... solves it. One last question, if I may: both expected_stuff and archive.expected_stuff are defined as: ( source CHAR(2); warehouse CHAR(1); stuff SMALLINT; packslip CHAR(12) ); and o is expected_stuff%ROWTYPE Having the same structure, I put INSERT

Re: [GENERAL] query ... returned 4 columns

2007-03-08 Thread Richard Huxton
Sorin Schwimmer wrote: Hi All, I'm trying to write a stored PLPG/SQL procedure: o:= * FROM expected_stuff WHERE packslip=$1; -- LIMIT 1; Is this valid syntax? I'm a little surprised, but I think I can see what's happening. Try something more like: SELECT * INTO o FROM expected_stuf

Re: [GENERAL] query ... returned 4 columns

2007-03-08 Thread Tom Lane
Sorin Schwimmer <[EMAIL PROTECTED]> writes: > DECLARE > o expected_stuff%ROWTYPE; > BEGIN > o:= * FROM expected_stuff WHERE packslip=$1; -- Use SELECT * INTO o FROM expected_stuff WHERE ... The assignment syntax is currently only supported for scalar values, I believe.

[GENERAL] query ... returned 4 columns

2007-03-08 Thread Sorin Schwimmer
Hi All, I'm trying to write a stored PLPG/SQL procedure: CREATE OR REPLACE FUNCTION arch_expected_stuff(CHAR(12)) RETURNS VOID AS $$ -- Archives expected_stuff -- takes packing slip DECLARE o expected_stuff%ROWTYPE; BEGIN o:= * FROM expected_stuff WHERE packslip=$1; -- LIMIT 1;