How do we call c function from sql script
how do we call a C function from a SQL script?
int get_next_fbill_b2kId_seq_num(b2kIdType seq_val,bankIdPtrType bank_id)
{
validate_dc_alias(dcAlias);
tbaDateType sysDate;
tbaGetSystemDateTime(sysDate,NULL,NULL); /* returns in TBA date format */
sysDate[10] = EOS;
get_seq_value(next_num_char, 0, FBILL_B2KID_SRL_NUM,bank_id,TBAFATAL);
m_sprintf (seq_val, "%s%s%s", dcAlias, sysDate+8,next_num_char);
return(SUCCESS);
}
This is my function, defined in the cxx file. I want to call this in a SQL script. How can i do this?
0
saurabh
source
to share
2 answers
I assume the OP is using Oracle because he writes about PL / SQL.
You can call an external procedure c. http://www.shutdownabort.com/quickguides/c_extproc.php
+1
source to share
If your function is simple C, you need to create an executable and call it via ! or HOST .
If you are in a .Net environment, you can also create a .Net assembly containing your code and call your procedure as if it were a PL / SQL procedure.
0
source to share