DBAsupport.com Forums - Powered by vBulletin
Results 1 to 7 of 7

Thread: Help with setting a cursor to be used for a loop

Threaded View

  1. #3
    Join Date
    Mar 2005
    Posts
    143
    Sorry I am not explaining it well. I only need one fields value from the patient table. for example the form table has these fileds

    form-
    patient
    form_code
    date
    pform

    and the pateint table has these fields
    patient
    first
    last
    address

    my insert for one patient is
    insert into form values ('123', 'RESRCH', sysdate, '181281')
    that would be for the patient who's number is 123 in the patient table. I have to insert a row in the form table for each patient in the patient table and the first value needs to be the patient number.

    if I try :
    insert into PFORM values ((select "Patient" p1 from PATIENT where "Patient" NOT IN ( select a."Patient" from PATIENT A, PFORM B where a."Patient"=b."Patient")), 'RESRCH', trunc(sysdate), '20240', PFORM_PFORM_SEQ.nextVal, 'Research Consent & Info', '0','783285', trunc(sysdate), '1', '20240', trunc(sysdate), '0','0','', ' ', ' ', '0', ' ')
    which is what I think you sugested I get:
    ORA-01427: single-row subquery returns more than one row
    does this make more sense?
    sorry for the confusion.
    Last edited by jayjabour; 09-15-2010 at 04:13 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Click Here to Expand Forum to Full Width