Hi there--
I'm trying to restrict some of my programming logic to the database. I have
a table that has a one to many relationship with its data.
Specifically, I could have group 1 with 5 tie ins, like so (this table also
has a closed path which is used to find the left column):
1,2
1,5
1,200
1,4356
1,483
Given an insert request, I want the trigger to find out which # is used on
the left, and then randomly select one of the resultant rows and insert the
randomly picked row's PKEY value along with the original insertion info.
into a third table.
Here is how to do it in Oracle (non-trigger, but not hard to do). Can
someone tell me how to make it work in PGSQL???
SELECT * FROM
(SELECT XL.*, ROW_NUMBER() OVER (PARTITION BY 'Q' ORDER BY JOBID) AS N
FROM XEROXLOGENTRIES XL) X
WHERE X.N = ABS(MOD(DBMS_RANDOM.RANDOM, 100))
Aprpeciate it very much!
RDB
Randall Barber
Brigham Young University
rdb55@email.byu.edu