Search Postgresql Archives

Re: Cursor Issue??

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hey Roman,

Thanks for your reponse's!

I made it happen in MicrosoftSQL using the first code below.  The only
difference is I had to create variables.  Which I'm having a hard time
trying to replicate it in psql.

__________Microsoft Code___________
USE test
GO
DECLARE @qty INT, @Length varchar(20), @Width varchar(40)
DECLARE cursor1 SCROLL CURSOR FOR
SELECT * from Parts
OPEN cursor1
  FETCH FIRST FROM cursor1
  INTO @qty, @Length, @Width
  INSERT INTO PartsTemp (qty, Length, Width)
	VALUES (@qty, @Length, @Width)
CLOSE cursor1
DEALLOCATE cursor1
GO


__________psql Code___________
(These declaration of vaiables don't work)
DECLARE c_qty INT;
DECLARE c_Length FLOAT;
DECLARE c_Width FLOAT;

BEGIN;
DECLARE cursor1 CURSOR FOR SELECT * FROM Parts;
FETCH FIRST FROM cursor1 INTO c_qty, c_Length, c_Width;
INSERT INTO partstemp VALUES (c_qty, c_Length, c_Width);
CLOSE cursor1;
COMMIT;

Got any ideas using variable to transfer singular rows?


---------------------------(end of broadcast)---------------------------
TIP 5: don't forget to increase your free space map settings

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux