Skip to Main Content

Database Software

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to call Function(User Build-in Function) in Pro*C Program

user12103686Mar 29 2010 — edited Mar 30 2010
We have developed the application used Pro*C Program.
TimesTen version is "TimesTen Release 11.2.1.5.0 (64 bit Linux/x86_64) (tt112150:53308) 2010-03-04T20:39:30Z".

We would like to develop Pro*C Program used PL/SQL.

We have some questions.
How to call Function(User Build-in Function) in Pro*C Program ?

#########
TEST
#########

ttisql :
Command> create or replace FUNCTION F_SAMPLE(i_str IN VARCHAR2)
> RETURN NUMBER IS
> o_number NUMBER;
> BEGIN
> select i_str
> into o_number
> from dual;
>
> RETURN o_number;
>
> EXCEPTION
> WHEN OTHERS THEN
> RETURN 0;
> END;
> /
show errors
Function created.
Command> show errors
No errors.
Command>
Command> set serveroutput on;
Command> declare
> num1 number;
> begin
> num1 := F_SAMPLE('A');
> DBMS_OUTPUT.PUT_LINE ('F_SAMPLE' || ' ' || num1);
> end;
> /
F_SAMPLE 0

PL/SQL procedure successfully completed.

Command>


Pro*C Case :

EXEC SQL BEGIN DECLARE SECTION;
num1 number;
EXEC SQL END DECLARE SECTION;

EXEC SQL EXECUTE
begin
:num1 := F_SAMPLE('A');
end;
END-EXEC;

make install :
Syntax error at line 146, column 3, file plsqlPROC.pc:
Error at line 146, column 3 in file plsqlPROC.pc
num1 number;
..1
PCC-S-02201, Encountered the symbol "num1" when expecting one of the following:


Thanks.

GooGyum
This post has been answered by ChrisJenkins-Oracle on Mar 30 2010
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 27 2010
Added on Mar 29 2010
2 comments
2,178 views