RE: 3836 Problems with Oracle on Primos -> Using SQL with proc

From: John Hawkins <johnh_at_nnshh127.uucp>
Date: Wed, 5 May 1993 17:20:43 GMT
Message-ID: <C6KDIK.K1p_at_news.rich.bnr.ca>


To: bill_at_nx26.mik.uky.edu (Mustang)
Subject: Re: Problem With Oracle on Primos -> Using SQL Code in a C program

IN proc it is important that any variables you use are defined in the
EXEC SQL BEGIN DECLARE SECTION;
your types are limited
with characters to varchar definitions
EXEC SQL END DECLARE SECTION; Therfore you must declare both temp_ssn and input_ssn in these sections, as whatever number type you disire.
You would probaly have to transfer the number into an array with a c function.

NOTE: Null values must be taken care of because null never equals null.

In article <bill.736145110_at_mik.uky.edu>, you write:
|> I am trying to assign a value from an SQL table to a variable. My code
|> looks something like this:
|>
|>
|> printf("Please Enter The Social Security Number to Search for: \n");
|> input_ssn = getnum(); /*** Gets a number of type integer ***/
|> EXEC SQL
|> SELECT patient_ssn
|> INTO :temp_ssn /*** Temporary Value to store SSN in ***/
|> FROM patients
|> WHERE patient_ssn = input_ssn;
|>
|> I want to use this social security number in an array in the C progam but
|> am finding it hard to retrieve this value from the table and assign it to
|> a variable in the program. Any suggestions? Is this format even right or
|> do I need to use the DEFINE ____ AS CURSOR command? Any suggestions would
|> be GREATLY appreciated!!! Or instructor doesn't even know Oracle! That's
|> quaint, isn't it?!?
|>
|>
|> Bill Ferring
|>
|> --
|> _____ __ __ __ ___________________________________________
|> | _ \| || | | | | Confuscious Say: |
|> | _ <| || |__ | |__ | Man who fart in church, sit in own pew! |
|> |_____/|__||_____||_____| |___________________________________________|

-- 
John Hawkins       || #define disclaimer(X) fprintf(stderr," X\n");
Northern Telecom   || Voice: 615-734-4468                 /* Able was I, ere */
200 Athens Way     || Fax:   615-734-4771                 /* I saw Elba      */
Nashville TN 37728 || Internet:  nvjhh01_at_NT.COM           /* Who?            */
Received on Wed May 05 1993 - 19:20:43 CEST

Original text of this message