473,545 Members | 2,451 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Need Help on Pro-C

1 New Member
Hello Friends.. I am working on some Pro-C program using Dynamic SQL. I am fetching a set of values and storing those in an host variable array of datatype long. The fetching into the array is working fine. But when I use the in correlated subquery having "NOT IN" and "IN" clause, it behaves differently. For "IN" clasue, the array works fine, but for "NOT IN" clause, it does not work. For example, I have created the following small piece of code.

I have long array MyNum[3]. The Table TEST_LOC has 6 records, 3 records have SerialNum same as those given in MyNum array. When I use "IN" clause, 3 records are inserted in TEST_LOC1 Table. But when I use "NOT IN" clause, it inserts 15 records with duplicate values. I am unable to solve it till now.

Can someone please help me on this? Thanks a lot..
--Sain

--------------------------------------- Sample Pro-C Code -----------------------------
/* This program uses dynamic SQL Method 2 to insert rows into second table from first table. */

#include <stdio.h>
#include <string.h>
#include <stdlib.h>

EXEC SQL INCLUDE "sqlca.h";
EXEC SQL INCLUDE "oraca.h";
EXEC ORACLE OPTION (ORACA=YES);

VARCHAR dynstmt[80];

void main()
{
EXEC SQL BEGIN DECLARE SECTION;
char connStr[101]="";
char TName[20] = "TEST_LOC1" ;
long MyNum[3] = {18, 21, 12};
EXEC SQL END DECLARE SECTION;

oraca.orastxtf = ORASTFERR;
strcpy(connStr, "psoproj/psoproj@epsnsde v");

EXEC SQL CONNECT :connStr;
if(sqlca.sqlcod e != 0)
{ printf("ERROR: Unable to connect to oracle SQLCODE: %d", sqlca.sqlcode);
exit(1);
}
puts("\nConnect ed to Oracle.\n");

sprintf((char *)dynstmt.arr, "INSERT INTO %s select * from TEST_LOC a1
WHERE a1.SERIALNUM IN (:v1)", TName);

// sprintf((char *)dynstmt.arr, "INSERT INTO %s select * from TEST_LOC a1
// WHERE a1.SERIALNUM NOT IN (:v1)", TName);

dynstmt.len = (unsigned short)strlen((c har *)dynstmt.arr);
puts((char *) dynstmt.arr);

EXEC SQL PREPARE S FROM :dynstmt;
EXEC SQL EXECUTE S USING :MyNum ;

printf("\n Value of sqlcode:%d \n", sqlca.sqlcode);

EXEC SQL COMMIT WORK RELEASE;
puts((char *)"\nHave a good day!\n");
exit(0);
}
------------------------- End of Sample Code ------------------------

The Tables TEST_LOC and TEST_LOC1 have same table structure:
CREATE TABLE TEST_LOC
( NAME VARCHAR2(30 BYTE) NOT NULL,
SERIALNUM NUMBER NOT NULL,
ADDDT DATE DEFAULT SYSDATE NOT NULL
);
Apr 4 '07 #1
0 1901

Sign in to post your reply or Sign up for a free account.

Similar topics

10
2781
by: Mary Ellen Curtin | last post by:
arrgh. Because I can't afford a new system right now, I'm running a hamster-powered Pentium 166, 64 M RAM, Win 95. I've been using Dreamweaver3, but I've now reached my limit. *rends DW3 with teeth & claws* Why have I stuck with DW this long? - good website management -- I have 6 or 7 so far, and DW is handy for integrating site...
4
1032
by: newgenre | last post by:
My system was updated by a shop now out of business. They installed Windows XP-Pro on it but there is no IIS. I am trying to add Visual Basic.Net to my system. Is there a way to DL IIS for my system? Jim
6
1459
by: darrel | last post by:
(Sincere apologies for crossposting. I posted it in vs.net ide, but then realized that group gets little to no traffic these days. I was hoping to get some insight on this before the weekend.) I do some VB.net development at work using Win2K and VS.net. This works fine. Run IIS locally, compile via VB.net and test. I'd like to do a bit of...
13
1929
by: Howard Kaikow | last post by:
I just visited the MSFT web site and saw the comparison/pricing of the different VS 2005 versions. I was looking for a statement of the system requirements for VS Pro and VSTO, could not find. Also, more details on the differences between VS Pro and VSTO. For example, can VSTO be used to create a DLL, in particular, a DLL that can be used...
5
2930
by: HotRod | last post by:
I am new to this so please go easy. We currently have some students doing some work on some web based tracking documents for us. They are currently using VB .net to develop what we requested. Anyway I've been calling my local ISP's and no one supports .net it seems to be all apache and MySQL. I'm wondering if everyone here can answer a few...
0
978
by: kumar77 | last post by:
I have some doubts in Pro*C: 1)after precompiling a pro*C program how will be the output will be displayed i.e. how the SELECT statements are replaced by C stmts? 2)How to debug the Pro*C program?Which debugger is used? 3)When an error occurs after precompilation of a pro*C program,where to see the logical errors? 4)Is Pro*C a...
26
9219
by: empriser | last post by:
#define XLOG( ... ) \ do{ \ sprintf( SysBuf, " ", curtime(), __FILE__ , __LINE__ , __FUNCTION__ ); \ sprintf( SysBuf + strlen( SysBuf ), __VA_ARGS__ ); \ xlog( SysBuf ); \ }while(0) I compile the with Pro*c, but it gave me the error message... ,
1
4843
by: DR | last post by:
What ports do i need to unblock on client and server (running msvsmon.exe) to debug remotely from my client box with visual studio 2005 pro? When I attach to remote process a connection shows up in msvsmon.exe on the remote machine, however, the client box with visual studio displays error: "Unable to connect to the mricosoft visual studio...
8
1473
by: Mr. R | last post by:
Hi I need to set up a server that supports ASP.NET. I will have it in my home and run on and off for demo projects. The problem is that I don't have then money to by Windows Server 2003 or Windows Server 2008. I have tried to install IIS but that doesn't help me at all. I have tried Apache and the Mono projects tools which also fails. Tried...
1
1706
by: vfpgood | last post by:
Hello,guy! My work is to design labels. Can anyone introduce a simple, easy and professional system for bar code label design . Set design drawings, generate bar code generation and batch printing in one. I have found a software called "Label mx pro",and I have use "label mx pro" for several month.The application work...
0
7487
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7420
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7680
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7934
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
6003
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
4966
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3476
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
1908
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1033
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.