SHARE
TWEET

Untitled

a guest Jun 20th, 2019 62 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. My Location table:
  2. <pre>
  3.  
  4. +-------------+---------+---------+
  5. | Location_Id | Address | Country |
  6. +-------------+---------+---------+
  7. |           1 | London  |  London |
  8. |           2 | US      |    null |
  9. +-------------+---------+---------+
  10. </pre>
  11.  
  12. My code:
  13. /*connect to db*/
  14. void connect()
  15. {
  16.     /* Connect to ORACLE. */
  17.     strcpy(username, "hr");
  18.     strcpy(password, "hr");
  19.  
  20.     EXEC SQL DECLARE DB_NAME DATABASE;
  21.     EXEC SQL CONNECT : username IDENTIFIED BY : password;
  22.     printf("nConnected to ORACLE as user: %sn", username);
  23. }
  24.  
  25. void testNull()
  26. {
  27.     short state_ind = -1;
  28.     char address[20];
  29.     char *state_province_input = "state_province";
  30.     EXEC SQL SELECT STREET_ADDRESS INTO : address FROM LOCATIONS
  31.     WHERE : state_province_input INDICATOR : state_ind is null;
  32.     printf("address :%s, state: %sn", address, state_province_input);
  33.     printf("indicator: %dn", state_ind);
  34. }
  35.  
  36. void main()
  37. {
  38.     connect();
  39.     testNull();
  40. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top