niXforums Forum Index
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   PreferencesPreferences   Log in to check your private messagesLog in to check your private messages   Log inLog in 
·  nixdoc.net ·  man pages ·  Linux HOWTOs ·  FreeBSD Tips ·  Forums
navigation Forum index » Databases » Oracle » Tools
Calling stored procedure in PRO C
Post new topic   Reply to topic Page 1 of 1 [2 Posts] View previous topic :: View next topic
Author Message
abhi147@gmail.com
*nix forums beginner


Joined: 19 Jul 2006
Posts: 1

PostPosted: Wed Jul 19, 2006 5:07 am    Post subject: Calling stored procedure in PRO C Reply with quote

Hi ,
I am very new to Pro C . I have a stored procedure like
abc ( IN a , IN b , IN/OUT c)
I want to call this procedure but I don't know how to get the output
parameter c after the execution .
The sub program is as follows :
EXEC SQL BEGIN DECLARE SECTION;
char *a;
char *b;
varchar c[8];
EXEC SQL END DECLARE SECTION;

a = "A";
b = "B";
c = "normal";

EXEC SQL EXECUTE
BEGIN
abc(:a, :b, :c );
END;
END-EXEC;

Please tell me if i am executing the procedure correctly . And how can
i get the output argument c .

Thanks in advance
Back to top
Dave
*nix forums Guru


Joined: 19 Feb 2005
Posts: 1725

PostPosted: Wed Jul 19, 2006 8:41 am    Post subject: Re: Calling stored procedure in PRO C Reply with quote

abhi147@gmail.com wrote:
Quote:
Hi ,
I am very new to Pro C . I have a stored procedure like
abc ( IN a , IN b , IN/OUT c)
I want to call this procedure but I don't know how to get the output
parameter c after the execution .
The sub program is as follows :
EXEC SQL BEGIN DECLARE SECTION;
char *a;
char *b;
varchar c[8];
EXEC SQL END DECLARE SECTION;

a = "A";
b = "B";
c = "normal";

This won't work at all. Generally string assignment is done in C with
strcpy, not with =, although for complicated reasons char *a; a="a";
will work providing you never need to change the contents of a (except
via another assignment). You should use strcpy for string assignment
and define strings as char name[length] unless you know exactly what you
are doing.

Not sure why you used varchar for c instead of char; if you do char
c[8]; and strcpy(c,"normal"); that should work fine, and the result of
the SP will then be in c after the end-exec.

Quote:

EXEC SQL EXECUTE
BEGIN
abc(:a, :b, :c );
END;
END-EXEC;

Please tell me if i am executing the procedure correctly . And how can
i get the output argument c .

Depends what you mean by "get." If you follow the end-exec with a
puts(c); that should display it.

Dave.
Back to top
Google

Back to top
Display posts from previous:   
Post new topic   Reply to topic Page 1 of 1 [2 Posts] View previous topic :: View next topic
The time now is Mon Dec 01, 2008 10:24 pm | All times are GMT
navigation Forum index » Databases » Oracle » Tools
Jump to:  

Similar Topics
Topic Author Forum Replies Last Post
No new posts postfix smtp authentication using mysql stored user/pass rtresidd Postfix 0 Fri Oct 03, 2008 5:58 am
No new posts How to ALTER a table using the ALTOBJ procedure Serge Rielau IBM DB2 1 Fri Jul 21, 2006 1:06 pm
No new posts How do I render JPEG Data stored in char* buffer? On the Sparrow C++ 2 Thu Jul 20, 2006 8:44 pm
No new posts calling stored procedure using ECPG Jasbinder Bali PostgreSQL 1 Thu Jul 20, 2006 7:53 pm
No new posts Error while calling an Oracle Stored Procedure from VB us... macca Server 5 Thu Jul 20, 2006 9:32 am

Free Ringtones | Cheap Plane Tickets | Remortgages | Credit Card | Loans
Copyright © 2004-2005 DeniX Solutions SRL
 
Other DeniX Solutions sites: Unix/Linux blog |  electronics forum |  medicine forum |  science forum | 
Privacy Policy


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.1813s ][ Queries: 16 (0.0977s) ][ GZIP on - Debug on ]