×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Trigger help!

Trigger help!

Trigger help!

(OP)
I am used to writting triggers for MSSQL but have come unstuck now I need to write one for a postgres db. If anyone can help I would be very appreciative.

I have a cdr table that receives data as follows:

insert into lookup_cdr (setup_time, gatekeeper_name, call_number, call_duration, disconnect_cause, acct_session_id, h323_id, gkip, callid, confid, caller_ip, caller_port, callee_ip, callee_port, src_info, dest_info, calling_station_id, called_station_id, dialed_number)
values ('2007-01-07 17:50:16', 'xxxxxxxxxxxxxx', '1', 0, 0, '45a132d100000001', 'root', xxx.xxx.xxx.xxx', '', '', 'xxx.xxx.xxx.xxx', '56250', 'xxx.xxx.xxx.xxx', '1720', 'root:h323_ID', '1234234334477221111111:dialedDigits', '', '', '');

at present I fire this string:

insert into lookups (msisdn, mobileno) select substr('1234234334477221111111:dialedDigits',5,5) as msisdn, substr('1234234334477221111111:dialedDigits',10,12) as mobileno where length('1234234334477221111111:dialedDigits') = 34 and 'xxx.xxx.xxx.xxx' = 'xxx.xxx.xxx.xxx'

however due to restrictions within the application I need to move this second insert on to a trigger. '1234234334477221111111:dialedDigits' would be being passed to the trigger as a value from the insert. Where as the 'xxx.xxx.xxx.xxx's would be hard coded.


I hope this makes some sort of sense!

Thanks for any help :)

Neil

RE: Trigger help!

Have you checked the Postgres Help for Triggers?   

Unlike the MySQL help search for simple terms, your search should go quite fast and easy in Postgres.  In the help index, just type "trigger".  


Gary
gwinn7

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close