This discussion is archived
2 Replies Latest reply: Nov 7, 2012 3:05 AM by 761705 RSS

Help regarding the calling of a oracle function from the OTL.

761705 Newbie
Currently Being Moderated
Hi,
I created a Oracle function like get_employee_id() which will return the employee id if the name and department exists.
If not exists it will insert the record and return the emp_id.

get_employee_id(name,department)
if name and department exists id will be returned
else record will be inserted and emp id will be returned.

emp_id is a sequence which will be triggered to auto increment.

Problem is::
Not getting a correct way to access get_employee_id() from OTL interface.

I am trying like
query << "BEGIN :3<int> := get_employee_id(:1<char[128]>,:2<char[1024]>); END;" ;
otl_stream oos(1, query.str().c_str(), db());

oos << emp_name ;
oos << emp_dept ;

while(true){
oos >> emp_id ;
if(!oos) break ;
}

Please let me know what is the correct way of accessing this.Thanks for the help in advance.

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points