Help - Pro*C update question

From: Harry Boswell <hboswell_at_dave.wes.army.mil>
Date: 27 Sep 1994 20:52:46 GMT
Message-ID: <36a0mv$2bs_at_Joanna.Wes.Army.Mil>


I'm having trouble with a Pro*C update program. I've written only selects in Pro*C up till now, and I can't get this thing to work. Here's what I have:

int oracle_login()
{

 strcpy(userid.arr, USERID);
 strcpy(password.arr, PASSWORD);
 userid.len = strlen(userid.arr);
 password.len = strlen(password.arr);
 exec sql connect :userid identified by :password;  return sqlca.sqlcode;
)

void upd_pv()
{

 exec sql whenever sqlerror goto error_exit;  exec sql whenever not found goto not_found;  exec sql update acf_act_data

    set pv = :hpv
    where rec_id = :hrec_key;
 exec sql commit;
 return;
error_exit:
 printf("\n%.70s (%d)",sqlca.sqlerrm.sqlerrmc, -sqlca.sqlcode);  exec sql rollback work release;
 exit(0);
not_found:
 printf("%8s --> Not found\n", hrec_key.arr); return;
}

[end of code]

The variables hrec_key and hpv are being read in from a Unix file - I've written a short program to inspect the values actually going into the variables, and they seem to be OK. But when I run this, it sits at the first update and never does anything. No update, apparently no attempt to update. What gives?

Any and all help appreciated greatly (i.e., they're breathing down my neck!)

--
Harry Boswell                 hboswell_at_dave.wes.army.mil  
Received on Tue Sep 27 1994 - 21:52:46 CET

Original text of this message