473,387 Members | 1,318 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

can you use variables in PostgreSQL rules?

i am currently migrating a db from Oracle to Pg and in some of my
triggers i use variables, i.e. i have some thing like this:



[Oracle version]



CREATE OR REPLACE TRIGGER "USERACTION_VIEW" INSTEAD OF INSERT ON
"USERACTION_VIEW" DECLARE

UserActionID INTEGER;

UserActionDataID INTEGER;

begin

SELECT USERACTION_SQ.nextval into UserActionID FROM DUAL;

SELECT USERACTIONDATA_SQ.nextval into UserActionDataID FROM DUAL;



INSERT INTO USERACTION

(

UserActionID,

LocalID,

UserActionTypeID,

ActionDate

)

VALUES

(

UserActionID,

:new.LocalID,

:new.UserActionTypeID,

SYSDATE

);



INSERT INTO USERACTIONDATA

(

UserActionDataID,

UserActionID,

AccountID,

CourseRecordID,

CourseRecordPaymentID,

StudentID,

CourseRecordTestID,

CourseRecordLessonID

)

VALUES

(

UserActionDataID,

UserActionID,

:new.AccountID,

:new.CourseRecordID,

:new.CourseRecordPaymentID,

:new.StudentID,

:new.CourseRecordTestID,

:new.CourseRecordLessonID

);



end;





so basically i have two variables here, UserActionID and
UserActionDataID. so when i am porting to PostgreSQL i will need to make
this a rule since Pg triggers only work for tables. The problem though
is that i don't know how to use variabvles in Pg rules. Any ideas? Is it
possible at all?



Thanks.
Nov 23 '05 #1
0 2630

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

125
by: Sarah Tanembaum | last post by:
Beside its an opensource and supported by community, what's the fundamental differences between PostgreSQL and those high-price commercial database (and some are bloated such as Oracle) from...
6
by: MaRcElO PeReIrA | last post by:
Hi guys, Do you know any web based bug tracker software that use PostgreSQL??? Somebody has told me about Mantis, but it use MySQL... and I resign to use that! :( Which is the best bug...
29
by: Paul Ganainm | last post by:
Hi all, Following up on another thread, here is a comparison between FB and PG from an FB'ers POV. BTW, FB is the love-child of Open-Source-Interbase. BTW, I have tried to be as accurate as I...
175
by: Sai Hertz And Control Systems | last post by:
Dear all, Their was a huge rore about MySQL recently for something in java functions now theirs one more http://www.mysql.com/doc/en/News-5.0.x.html Does this concern anyone. What I...
9
by: vp | last post by:
Can I safely assume that all static variables are initialized as NULL or zero, depending on the types of the variables, no matter on which platform that app is compiled ? Thanks for your help, ...
0
by: lnd | last post by:
A few question regarding PostgreSQL handling of queries: - Is each query submitted parsed and planned even if it is identical to a query submitted before? For example, 10 queries "select * from...
6
by: Grainne Reilly | last post by:
I am new to PostgreSQL and am porting some scripts written for MySQL over to psql. There is one MySQL feature which I cannot find in psql - user defined SQL variables. In MySQL I can use these to...
2
by: Mike Morris | last post by:
Hi, I've setup a postgres server (7.4) and confirmed that SSL is enabled - I can successfully connect via tcp socket over SSL using the psql client. From PHP4, how can I get the pg_connect...
2
by: bogie | last post by:
Dear Postgresql forum, I have some question related to the rules in postgresql. I have a table invention with the following rules Rules : rule_invention_insert, ...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.