Re: PRO C 1.6/2.0 Problem

From: Thomas J. Kyte <tkyte_at_us.oracle.com>
Date: 1996/06/08
Message-ID: <31b9d450.13729842_at_dcsun4>#1/1


On 8 Jun 1996 10:08:27 -0400, dmsknox_at_aol.com (Dmsknox) wrote:

>I am having a problem with Pro C 1.6 on a Alpha OpenVMS machine running
>Oracle 7.1.5. In the program I have the following statement:
>
>exec sql select doc_type_cd into :doc_type_tmp
>from doc_type where old_doc_type_cd = :old_doc_type_cd
>
>the program compiles but when it runs it ALLWAYS returns
>no_data_found! I have evaluated the values in the debugger and
>all values are correct. If I hard code the the same value in place
>of the old_doc_type_cd variable it will operate correctly. Does anyone
>have any Ideas?

It sounds like old_doc_type_cd is defined as a CHAR in the database and pro*c is using a varchar in the query. Chars and Varchars (as per ansi) don't compare very well. If you ever find that:

select * from T where x = 'HELLO'

returns rows but:

strcpy( bv, 'HELLO' );
select * from T where x = :bv

does not, then you have a char in the database and are trying to retrieve it by comparing to a varchar.

The workaround is:

select * from T where x = rpad( :bv, LENGTH_OF_X_AS_DEFINED_IN_DATABASE );

(btw: a little snippet of pro*c code would have been helpful here, how you declare the bind variables will tell proc how to treat the bind variable. Did you declare :old_doc_type_cd as a VARCHAR or as char old_doc_type_cd[] ? )

>
>
>
>
>After discovering this problem in a machine in the field we discovered
>that the
>program in question worked on our office machine with the same environment
>except it was running proc 2.0. Great we updated the compilers and
>attempted
>to rebuild the application using the command
>
>proc iname=prog.pc
>
>this command works just fine on our office machine but on the customer
>machine it gives us a compiler error that it is unable to open the include
>
>file. Customer support is stuck on the idea that I nead a compiler
>command
>like:
>
>proc include=alpha1$library iname=sample1.pc
>
>I have tried this and it gives the same error and this is NOT needed on
>our
>office machine.
>
If you just type "proc" on the command line, you will see a message such as:

....
System default option values taken from: /usr/oracle/proc/pmscfg.h ....

Do this on your machine and the customers. Make sure the "system default option values" files contain the same things. Yours may have the include=path command in it and theirs does not. I am not familar with VMS so I can't give you the correct path but support is on the right track. When proc v2 can't find the include file, you need to set the include= parm. When it complains about the missing header file, determine where it is on the system and use include=path on the next try at precompiling. Perhaps the customer has put their standard include files in a non-standard location?

>
>Your help in solving either of these errors will be greatly appreciated.
>
>Thanks,
>
>John Hough

Thomas Kyte
Oracle Government
tkyte_at_us.oracle.com                          

http://govt.us.oracle.com -- Check out our web site! Brand new, uses Oracle Web Server and Database


statements and opinions are mine and do not necessarily reflect the opinions of Oracle Corporation Received on Sat Jun 08 1996 - 00:00:00 CEST

Original text of this message