Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- My Location table:
- <pre>
- +-------------+---------+---------+
- | Location_Id | Address | Country |
- +-------------+---------+---------+
- | 1 | London | London |
- | 2 | US | null |
- +-------------+---------+---------+
- </pre>
- My code:
- /*connect to db*/
- void connect()
- {
- /* Connect to ORACLE. */
- strcpy(username, "hr");
- strcpy(password, "hr");
- EXEC SQL DECLARE DB_NAME DATABASE;
- EXEC SQL CONNECT : username IDENTIFIED BY : password;
- printf("nConnected to ORACLE as user: %sn", username);
- }
- void testNull()
- {
- short state_ind = -1;
- char address[20];
- char *state_province_input = "state_province";
- EXEC SQL SELECT STREET_ADDRESS INTO : address FROM LOCATIONS
- WHERE : state_province_input INDICATOR : state_ind is null;
- printf("address :%s, state: %sn", address, state_province_input);
- printf("indicator: %dn", state_ind);
- }
- void main()
- {
- connect();
- testNull();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement