Urgent help: User variables
Urgent help: User variables
От:
Rosa.Carro@ii.uam.es
Дата:
Hello everybody, I am using PostgresSQL in Linux, and I want to declare a user variable so that I can use its value for new queries after giving it a value. While using WinNT and SQL Server I was writting (for example ): declare @@task_id int selct @@task_id = id from task were name ='Mytask' update task set final='N' where id = @@task_id But when I write these sentences in Postgres for Linux (I am using RedHat 6.0), I am told: "ERROR: parser: parse error at or near @@" How can I do the same? Thank you very much, Rosa -------------------------------------- Rosa Maria Carro Salas E.T.S.Informatica Universidad Autonoma de Madrid Cantoblanco 28049, Madrid (Spain) phone: +34 1 348 2291
Embedded SQL (II)
От:
Rosa.Carro@ii.uam.es
Дата:
Hello, colleages, I have run a C program with embedded SQL, but the changes (insert sentences) don't keep data in the database. When I connect to the database by writting "psql database" and I do the selects, nothing appears. If I write the same SQL sentences in psql, the changes keep done. I wasn't using transactions, but now I have included them, although the same thing happens again. Any idea about this? The code is: EXEC SQL BEGIN DECLARE SECTION; ... ... EXEC SQL END DECLARE SECTION; EXEC SQL CONNECT TO db USER username; EXEC SQL BEGIN TRANSACTION; EXEC SQL INSERT INTO table (...) VALUES (...); EXEC SQL INSERT INTO table (...) VALUES (...); EXEC SQL INSERT INTO table (...) VALUES (...); ... EXEC SQL COMMIT TRANSACTION; EXEC SQL DISCONNECT; ------------------------------------------ Rosa Maria Carro Salas E.T.S.Informatica Universidad Autonoma de Madrid Cantoblanco 28049, Madrid (Spain) phone: +34 1 348 2291