|
|
|
|
|
|
| Author |
Message |
Dave *nix forums Guru
Joined: 19 Feb 2005
Posts: 1725
|
Posted: Wed Jul 19, 2006 8:41 am Post subject:
Re: Calling stored procedure in PRO C
|
|
|
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 |
|
 |
abhi147@gmail.com *nix forums beginner
Joined: 19 Jul 2006
Posts: 1
|
Posted: Wed Jul 19, 2006 5:07 am Post subject:
Calling stored procedure in PRO C
|
|
|
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 |
|
 |
Google
|
|
| Back to top |
|
 |
|
|
The time now is Fri Nov 21, 2008 11:13 pm | All times are GMT
|
|
Football Predictions | Online advertising | Best Credit Cards | Dominios | 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
|
|