HRMorton
asked on
Call 'C' Function using SQL
Hi,
I have a C function, attached, which is usually called from a ProCobol program. I need to call this from SQL, passing in information taken from the database.
Is there a way of doing this ?
Thanks
Heather
I have a C function, attached, which is usually called from a ProCobol program. I need to call this from SQL, passing in information taken from the database.
Is there a way of doing this ?
Thanks
Heather
void CMMODCHK (char *SortCode,
char *SortCodeLen,
char *AccNumber,
char *AccNumberLen,
char *AccCode,
char *ModeFlag,
char *STSMODFAIL,
char *STSSCNIRGE,
char *STSNOBRNCH,
char *STSTRANDIS,
char *STSFOREIGN,
char *STSXSCRIBE,
char *STSROLLREQ,
char *STSBADSORT,
char *STSBADACNT,
char *STSDATFERR,
char *RESERVED1,
char *RESERVED2,
char *RESERVED3,
char *RESERVED4,
char *RESERVED5,
char *ErrorMsg)
{
char cmAccCode[ACCODELEN], cmSortCode[CHKPARAMLEN], cmAccNumber[CHKPARAMLEN];
char *index, instring[RECLEN], *instring_ptr, *instringTemp_ptr,
instringTemp[RECLEN], outstring[RECLEN];
ULONG cmModeFlag ;
int length, counter, rc, port_number, x;
int sock = -1 ;
struct hostent *raddr;
struct sockaddr_in addr ;
struct sockaddr myaddr;
/* Initialize */
STSMODFAIL[0] = STSSCNIRGE[0] = STSNOBRNCH[0] = STSTRANDIS[0] =
STSFOREIGN[0] = STSXSCRIBE[0] = STSROLLREQ[0] = STSBADSORT[0] =
STSBADACNT[0] = STSDATFERR[0] = RESERVED1[0] = RESERVED1[1] =
RESERVED2[0] = RESERVED3[0] = RESERVED4[0] = RESERVED5[0] = ErrorMsg[0] = '\0';
......
ASKER
Hi,
This article relates to SQL Server, I'm using Oracle SQL. Is it the same principal ?
Thanks
Heather
This article relates to SQL Server, I'm using Oracle SQL. Is it the same principal ?
Thanks
Heather
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Or from the Oracle Database Application Developer's Guide (for version 10.2) :
http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14251/adfns_extern_proc.htm#i1018255
http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14251/adfns_extern_proc.htm#i1018255
ASKER
Thanks guys, definately seems to be the route I need to take.
Thanks for the links, lots of reading to do, but very useful.
Will accept sunnycoder's solution.
Thanks again for all the help
Thanks for the links, lots of reading to do, but very useful.
Will accept sunnycoder's solution.
Thanks again for all the help
Look into extended stored procedures
http://www.devarticles.com/c/a/SQL-Server/Extended-Stored-Procedures-Intro-And-10-Cool-Examples/
http://support.microsoft.com/kb/190987
Regards,
sunnycoder