Home » Developer & Programmer » Precompilers, OCI & OCCI » Field values not getting printed at runtime
Field values not getting printed at runtime [message #151245] Tue, 13 December 2005 23:24
jaswin
Messages: 11
Registered: December 2005
Location: India
Junior Member
Hi.

This program is a simple one with one EXEC SQL statement to count the number of records from a table and print out the result.... It was working in Oracle7(Solaris) . Even in Oracle 10g(linux), it gets compiled properly .
I had compiled in Oracle 10g as :

1. $ proc sample.pc
2. $cc -L$ORACLE_HOME/lib -L/usr/lib -lclntsh -o sample sample.c.....


But during runtime it displays the fixed text part ......The count is........0......Now it should be 2 instead of 0 because the number of records in the table is 2. The owner of the
table is ops$exp......

The relevant part ot the program is as given below.....

#include <stdio.h>
#include "sqlca.h"
----
---
----
exec sql include sqlca;
exec sql include oraca;
EXEC SQL begin declare section;
char oracleid[25];
int count1;

EXEC SQL end declare section;

/* main program starts here */
main(argc,argv)
int argc;
char *argv[];
{

strcpy(oracleid,"/");

EXEC SQL connect :oracleid;

EXEC SQL select count(*) into :count1 from ops$exp.sample;
printf("The count is %d\n",count1);
}

regds.
J.S.Sachdeva
Previous Topic: Pro*c program not executing properly
Next Topic: OCCI resultset navigation.....some thing like move previous()
Goto Forum:
  


Current Time: Fri Mar 29 10:23:51 CDT 2024