embedded PL/SQL

From: Chris Xia <xia__chr_at_tasb.org>
Date: 1996/02/29
Message-ID: <4h4na8$d12_at_gatekeeper.tasb.org>


Greetings:

I wrote some embedded PL/SQl code on pro*c 1.4, it is so simple that I can't believe it could fail, but it failed anyway! It seems to me that It does not get executed for some reason. In the beginning of the PL/SQL block, i put an assignment statement: :error_msg := 'nothing happened'; immediately after the PL/SQL BLOCK, I printed it, IT IS EMPTY.

in the following, I include my code as well as .c file generated by the proc pre-compiler. If you know the solution or encounted the same problem, could you please let me know, your help will be highly appreciated!

I talked with an oracle support personal, he did not give me anything, and from my conversation with him, he even did not look at code!

Thanks.

  • begin of .pc code---------------------------------------

/*
NAME: docInfo.pc

PURPOSE: NOTES: Revision history:

*/

#include "oralib.h"

/********************************************************************  
     SCCSID AND COMPILING_TIME                                             
*********************************************************************/ 
                                                                       
static char sccsid[]   = "docInfo2.pc 1.4 created at 14:38:37 22 Feb 1996";              

/* declare both the sqlca and the oraca as extern since they are defined

    in oralib.a, which must be linked in with this program */

EXEC SQL INCLUDE sqlca.h;
#define SQLCA_STORAGE_CLASS extern

EXEC SQL INCLUDE oraca.h;
#define ORACA_STORAGE_CLASS extern

/* function prototypes for functions in oralib.a */
#ifdef ANSI

   extern int autoConnect(void);
   extern int oraConnect(char *uid, char *passwd);    extern FILE *openOutputFile(char *fname);    extern int closeOutputFile(FILE *fp, char *fname);    extern int getDateAndTime(void);

   extern int  getTimeStamp(void);
   extern int  checkSQLCode(void);
   extern void logoff(int status);

   extern void oracaLevel(int level);
   extern int varCopy(char *varArr, int varLen, char *string);
#else

   extern int autoConnect();
   extern FILE *openOutputFile();
   extern int closeOutputFile();
   extern int getDateAndTime();
   extern int getTimeStamp();
   extern int checkSQLCode();
   extern void logoff();
   extern void oracaLevel();
   extern int varCopy();
#endif

EXEC SQL BEGIN DECLARE SECTION;    /* the external variables are in oralib.a */

   extern char 		opsID;
   extern VARCHAR	userid[30];
   extern VARCHAR	password[30];
   extern VARCHAR	thetime[10];
   extern VARCHAR	today[10];
   extern VARCHAR	timeStamp[30];

   /* declare your own variables here */

   VARCHAR	orgNum[7];
   VARCHAR	baseOrg[7];
   VARCHAR	orgName[41];
   VARCHAR	polCode[6];
   VARCHAR	polType[4];
   VARCHAR	polVersion[5];
   VARCHAR	polTitle[256];
   VARCHAR	polSubTitle[256];
   varchar	updateNum[10];
   varchar	updateDate[10];
   varchar	lduNum[10];
   varchar	lduDate[10];
   VARCHAR	change_date[10];
   varchar      userId[10];

EXEC SQL END DECLARE SECTION; void getBaseOrg();

int nameSearch = FALSE;

/* local functions */
#ifdef ANSI

int main(int argc, char *argv[])
#else

main(argc, argv)
int argc;
char *argv[];
#endif

{
int status = 0;
  ....               

#ifdef ANSI

int getDocInfo(void)
#else

int getDocInfo()
#endif

{

exec sql begin declare section;
int status = 0;
int len = 0;
char error_msg[120];
exec sql end declare section;         

        getBaseOrg();

        /* initialize the length of each output varchar */

          updateNum.len = 10;
          updateDate.len  = 10;
          lduNum.len = 10;
          lduDate.len = 10;
          orgNum.len  = 7;
          orgName.len = 41;
          polTitle.len = 256;
          polSubTitle.len = 256;


	EXEC SQL EXECUTE

        DECLARE 
           missing_update exception;
           missing_org    exception;
           missing_policy exception;
           missing_insert exception;
           orgType        varchar(4);
         BEGIN
           :error_msg :=  'nothing happening';

           select update_number, to_char(date_changed, 'MM/DD/YY'),
                  nvl(ldu_number,'NONE'), to_char(date_changed, 'MM/DD/YY')
           into :updateNum, :updateDate, :lduNum, :lduDate
           from   opus.update_history
           where org_number = :baseOrg 
             and policy_code = :polCode
             and  policy_type = :polType
             and  policy_version = :polVersion
             and  date_changed = (select max(date_changed) 
                                  from opus.update_history
                                  where org_number = :baseOrg 
                                   and  policy_code = :polCode
                                   and  policy_type = :polType
                                   and  policy_version = :polVersion
                                 );
           
           if SQL%NOTFOUND  then -- no such record in update history
                raise missing_update;
           end if;


           select org_number, org_name, org_type
           into :orgNum, :orgName, orgType 
           from opus.organization
           where org_number = :baseOrg;

           if sql%rowcount = 0 then -- illeagal organization
                raise missing_org;
           end if;

           select policy_name, policy_name_2 
           into :polTitle, :polSubTitle
           from  opus.policy_name
           where policy_code = :polCode 
             and org_type = orgType;

           if sql%rowcount = 0 then  -- illegal policy
              raise  missing_policy;
           end if;

           :status := 1; 


      EXCEPTION -- begining exception handling
          when missing_update then
              :status := 1;
              :error_msg := 'no record found in update_history'; 
          when missing_org then
              :status := 1;
              :error_msg := 'no record found in organization';
          when missing_policy then
              :status := 1;
              :error_msg := 'no record found in policy_name';
          when missing_insert  then
              :status := 1;
              :error_msg := 'error insert';
          when others  then
              :status := 1;
              :error_msg := 'error found in pl/sql block';

      END;    

    END-EXEC;    

       fprintf(stdout,"%s,%d\n", lduNum.arr, lduNum.len); 
       fprintf(stdout, "%s,%d\n", updateNum.arr, updateNum.len);

        fprintf(stdout, "%s\n", error_msg);
	return(status);

}

.......

  • beginning of .c file --------------------------------

/* File name & Package Name */
struct sqlcxp
{
  unsigned short fillen;

           char filnam[12];
};
static struct sqlcxp sqlfpn =
{

    11,
    "docInfo2.pc"
};

static unsigned long sqlctx = 0;

static struct sqlexd {

   unsigned long sqlvsn;
   unsigned short arrsiz;
   unsigned short iters;

   unsigned short   offset;
   unsigned short   selerr;
   unsigned short   sqlety;
   unsigned short   unused;
            short  *cud;
   unsigned char   *sqlest;
            char   *stmt;
   unsigned char  **sqphsv;
   unsigned long   *sqphsl;
            short **sqpind;
   unsigned char   *sqhstv[14];
   unsigned long    sqhstl[14];
            short  *sqindv[14];

} sqlstm = {3,14};
extern sqlcex(/*_ unsigned long *, struct sqlexd *, struct sqlcxp * _*/);
extern sqlcx2(/*_ unsigned long *, struct sqlexd *, struct sqlcxp * _*/);
extern sqlcte(/*_ unsigned long *, struct sqlexd *, struct sqlcxp * _*/);
extern sqlbuf(/*_ char * _*/);
extern sqlora(/*_ unsigned long *, void * _*/);

static int IAPSUCC = 0;

static int IAPFAIL = 1403;
static int IAPFTL = 535;
extern sqliem();
/* cud (compilation unit data) array */
static short sqlcud0[] =
{4,2,
2,0,0,0,27,104,3,3,0,1,0,1,9,0,0,1,10,0,0,1,10,0,0, 25,0,1,1253,6,189,14,14,0,1,0,2,1,0,0,2,9,0,0,2,9,0,0,2,9,0,0,2,9,0,0,1,9,0,0,1,9,0,0,1,9,0,0,1,9,0,0,2,9,0,0,2,9,0,0,2,9,0,0,2,9,0,0,2,3,0,0, 92,0,1,0,29,265,0,0,0,1,0,
};

/*

NAME:                   docInfo.pc 

PURPOSE: NOTES: Revision history:

*/

#include "oralib.h"

/********************************************************************  
     SCCSID AND COMPILING_TIME                                             
*********************************************************************/ 
                                                                       
static char sccsid[]   = "docInfo2.pc 1.4 created at 14:38:37 22 Feb 1996";              

/* declare both the sqlca and the oraca as extern since they are defined

    in oralib.a, which must be linked in with this program */

/* SQL stmt #1
EXEC SQL INCLUDE sqlca.h;
*/

/*
 * $Header: sqlca.h 1041000.1 92/09/10 09:13:12 jboyce Generic<base> $ sqlca.h 
 */

/* Copyright (c) 1985,1986 by Oracle Corporation. */  

/*
NAME
  SQLCA : SQL Communications Area.
FUNCTION
  Contains no code. Oracle fills in the SQLCA with status info   during the execution of a SQL stmt.
NOTES
  If the symbol SQLCA_STORAGE_CLASS is defined, then the SQLCA   will be defined to have this storage class. For example:  

    #define SQLCA_STORAGE_CLASS extern  

  will define the SQLCA as an extern.  

  If the symbol SQLCA_INIT is defined, then the SQLCA will be   statically initialized. Although this is not necessary in order   to use the SQLCA, it is a good pgming practice not to have   unitialized variables. However, some C compilers/OS's don't   allow automatic variables to be init'd in this manner. Therefore,   if you are INCLUDE'ing the SQLCA in a place where it would be   an automatic AND your C compiler/OS doesn't allow this style   of initialization, then SQLCA_INIT should be left undefined --   all others can define SQLCA_INIT if they wish.

  If the symbol SQLCA_NONE is defined, then the SQLCA variable will   not be defined at all. The symbol SQLCA_NONE should not be defined   in source modules that have embedded SQL. However, source modules   that have no embedded SQL, but need to manipulate a sqlca struct   passed in as a parameter, can set the SQLCA_NONE symbol to avoid   creation of an extraneous sqlca variable.  

MODIFIED
    losborne 08/11/92 - No sqlca var if SQLCA_NONE macro set

  Clare      12/06/84 - Ch SQLCA to not be an extern.
  Clare      10/21/85 - Add initialization.
  Bradbury   01/05/86 - Only initialize when SQLCA_INIT set
  Clare      06/12/86 - Add SQLCA_STORAGE_CLASS option.
*/  

#ifndef SQLCA
#define SQLCA 1
 

struct sqlca

         {
         /* ub1 */ char    sqlcaid[8];
         /* b4  */ long    sqlabc;
         /* b4  */ long    sqlcode;
         struct
           {
           /* ub2 */ unsigned short sqlerrml;
           /* ub1 */ char           sqlerrmc[70];
           } sqlerrm;
         /* ub1 */ char    sqlerrp[8];
         /* b4  */ long    sqlerrd[6];
         /* ub1 */ char    sqlwarn[8];
         /* ub1 */ char    sqlext[8];
         };

#ifndef SQLCA_NONE
#ifdef SQLCA_STORAGE_CLASS

SQLCA_STORAGE_CLASS struct sqlca sqlca
#else

         struct sqlca sqlca
#endif
 

#ifdef SQLCA_INIT

  • { {'S', 'Q', 'L', 'C', 'A', ' ', ' ', ' '}, sizeof(struct sqlca), 0, { 0, {0}}, {'N', 'O', 'T', ' ', 'S', 'E', 'T', ' '}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0} }
    #endif
    ;
    #endif

#endif
 

/* end SQLCA */
#define SQLCA_STORAGE_CLASS extern

/* SQL stmt #2
EXEC SQL INCLUDE oraca.h;
*/

/*
 * $Header: oraca.h 1041050.1 92/11/25 13:07:13 jboyce Generic<base> $ oraca.h 
 */

/* Copyright (c) 1985 by Oracle Corporation. */  

/*
NAME
  ORACA : Oracle Communications Area.
FUNCTION
  Contains no code. Provides supplementary communications to/from   Oracle (in addition to standard SQLCA). NOTES
  oracchf : Check cursor cache consistency flag. If set AND oradbgf

            is set, then directs SQLLIB to perform cursor cache
            consistency checks before every cursor operation
            (OPEN, FETCH, SELECT, INSERT, etc.).
  oradbgf : Master DEBUG flag. Used to turn all DEBUG options
            on or off.
  orahchf : Check Heap consistency flag. If set AND oradbgf is set,
            then directs SQLLIB to perform heap consistency checks
            everytime memory is dynamically allocated/free'd via
            sqlalc/sqlfre/sqlrlc. MUST BE SET BEFORE 1ST CONNECT
            and once set cannot be cleared (subsequent requests
            to change it are ignored).
  orastxtf: Save SQL stmt text flag. If set, then directs SQLLIB
            to save the text of the current SQL stmt in orastxt
            (in VARCHAR format).
  orastxt : Saved len and text of current SQL stmt (in VARCHAR
            format).
  orasfnm : Saved len and text of filename containing current SQL
            stmt (in VARCHAR format).

  oraslnr : Saved line nr within orasfnm of current SQL stmt.  

  Cursor cache statistics. Set after COMMIT or ROLLBACK. Each   CONNECT'd DATABASE has its own set of statistics.  

  orahoc : Highest Max Open OraCursors requested. Highest value

            for MAXOPENCURSORS by any CONNECT to this DATABASE.   oramoc : Max Open OraCursors required. Specifies the max nr

            of OraCursors required to run this pgm. Can be higher
            than orahoc if working set (MAXOPENCURSORS) was set
            too low, thus forcing the PCC to expand the cache.
  oracoc : Current nr of OraCursors used.   oranor : Nr of OraCursor cache reassignments. Can show the
            degree of "thrashing" in the cache. Optimally, this
            nr should be kept as low as possible (time vs space
            optimization).

  oranpr : Nr of SQL stmt "parses".
  oranex : Nr of SQL stmt "executes". Optimally, the relation-
            ship of oranex to oranpr should be kept as high as
            possible.
 
 

  If the symbol ORACA_NONE is defined, then there will be no ORACA   *variable*, although there will still be a struct defined. This   macro should not normally be defined in application code.

  If the symbol ORACA_INIT is defined, then the ORACA will be   statically initialized. Although this is not necessary in order   to use the ORACA, it is a good pgming practice not to have   unitialized variables. However, some C compilers/OS's don't   allow automatic variables to be init'd in this manner. Therefore,   if you are INCLUDE'ing the ORACA in a place where it would be   an automatic AND your C compiler/OS doesn't allow this style   of initialization, then ORACA_INIT should be left undefined --   all others can define ORACA_INIT if they wish.  

OWNER
  Clare
DATE
  10/19/85
MODIFIED
    losborne 09/04/92 - Make oraca variable optional     Osborne 05/24/90 - Add ORACA_STORAGE_CLASS construct

  Clare      02/20/86 - PCC [10101l] Feature: Heap consistency check.
  Clare      03/04/86 - PCC [10101r] Port: ORACA init ifdef.
  Clare      03/12/86 - PCC [10101ab] Feature: ORACA cuc statistics.
*/  

#ifndef ORACA
#define ORACA 1
 

struct oraca

         {
         char      oracaid[8];         /* Reserved                            */
         long      oracabc;            /* Reserved                            */
 
/*       Flags which are setable by User. */
 
         long      oracchf;            /* <> 0 if "check cur cache consistncy"*/
         long      oradbgf;            /* <> 0 if "do DEBUG mode checking"    */
         long      orahchf;            /* <> 0 if "do Heap consistency check" */
         long      orastxtf;           /* SQL stmt text flag                  */

#define ORASTFNON 0 /* = don't save text of SQL stmt */
#define ORASTFERR 1 /* = only save on SQLERROR */
#define ORASTFWRN 2 /* = only save on SQLWARNING/SQLERROR */
#define ORASTFANY 3 /* = always save */
struct { unsigned short orastxtl; char orastxtc[70]; } orastxt; /* text of last SQL stmt */ struct { unsigned short orasfnml; char orasfnmc[70]; } orasfnm; /* name of file containing SQL stmt */ long oraslnr; /* line nr-within-file of SQL stmt */ long orahoc; /* highest max open OraCurs requested */ long oramoc; /* max open OraCursors required */ long oracoc; /* current OraCursors open */ long oranor; /* nr of OraCursor re-assignments */ long oranpr; /* nr of parses */ long oranex; /* nr of executes */ };

#ifndef ORACA_NONE

#ifdef ORACA_STORAGE_CLASS

ORACA_STORAGE_CLASS struct oraca oraca
#else

struct oraca oraca
#endif
#ifdef ORACA_INIT

         =
         {
         {'O','R','A','C','A',' ',' ',' '},
         sizeof(struct oraca),
         0,0,0,0,
         {0,{0}},
         {0,{0}},
         0,
         0,0,0,0,0,0
         }

#endif
;

#endif

#endif

/* end oraca.h */
#define ORACA_STORAGE_CLASS extern

/* function prototypes for functions in oralib.a */
#ifdef ANSI

   extern int autoConnect(void);
   extern int oraConnect(char *uid, char *passwd);    extern FILE *openOutputFile(char *fname);    extern int closeOutputFile(FILE *fp, char *fname);    extern int getDateAndTime(void);

   extern int  getTimeStamp(void);
   extern int  checkSQLCode(void);
   extern void logoff(int status);

   extern void oracaLevel(int level);
   extern int varCopy(char *varArr, int varLen, char *string);
#else

   extern int autoConnect();
   extern FILE *openOutputFile();
   extern int closeOutputFile();
   extern int getDateAndTime();
   extern int getTimeStamp();
   extern int checkSQLCode();
   extern void logoff();
   extern void oracaLevel();
   extern int varCopy();
#endif

/* SQL stmt #3
EXEC SQL BEGIN DECLARE SECTION;
*/

   /* the external variables are in oralib.a */    extern char opsID;
   extern
/*
VARCHAR userid[30];
*/
struct {
  unsigned short len;
  unsigned char arr[30];
  } userid;
   extern
/*
VARCHAR password[30];
*/
struct {
  unsigned short len;
  unsigned char arr[30];
  } password;
   extern
/*
VARCHAR thetime[10];
*/
struct {
  unsigned short len;
  unsigned char arr[10];
  } thetime;
   extern
/*
VARCHAR today[10];
*/
struct {
  unsigned short len;
  unsigned char arr[10];
  } today;
   extern
/*
VARCHAR timeStamp[30];
*/
struct {
  unsigned short len;
  unsigned char arr[30];
  } timeStamp;

/*

   /o declare your own variables here o/

   VARCHAR orgNum[7];
*/
struct {
  unsigned short len;
  unsigned char arr[7];
  } orgNum;
/*

   VARCHAR baseOrg[7];
*/
struct {
  unsigned short len;
  unsigned char arr[7];
  } baseOrg;
/*

   VARCHAR orgName[41];
*/
struct {
  unsigned short len;
  unsigned char arr[41];
  } orgName;
/*

   VARCHAR polCode[6];
*/
struct {
  unsigned short len;
  unsigned char arr[6];
  } polCode;
/*

   VARCHAR polType[4];
*/
struct {
  unsigned short len;
  unsigned char arr[4];
  } polType;
/*

   VARCHAR polVersion[5];
*/
struct {
  unsigned short len;
  unsigned char arr[5];
  } polVersion;
/*

   VARCHAR polTitle[256];
*/
struct {
  unsigned short len;
  unsigned char arr[256];
  } polTitle;
/*

   VARCHAR polSubTitle[256];
*/
struct {
  unsigned short len;
  unsigned char arr[256];
  } polSubTitle;
/*

   varchar updateNum[10];
*/
struct {
  unsigned short len;
  unsigned char arr[10];
  } updateNum;
/*

   varchar updateDate[10];
*/
struct {
  unsigned short len;
  unsigned char arr[10];
  } updateDate;
/*

   varchar lduNum[10];
*/
struct {
  unsigned short len;
  unsigned char arr[10];
  } lduNum;
/*

   varchar lduDate[10];
*/
struct {
  unsigned short len;
  unsigned char arr[10];
  } lduDate;
/*

   VARCHAR change_date[10];
*/
struct {
  unsigned short len;
  unsigned char arr[10];
  } change_date;
/*

   varchar userId[10];
*/
struct {
  unsigned short len;
  unsigned char arr[10];
  } userId;

/* SQL stmt #4
EXEC SQL END DECLARE SECTION;
*/

void getBaseOrg();

int nameSearch = FALSE;

/* local functions */
#ifdef ANSI

int main(int argc, char *argv[])
#else

main(argc, argv)
int argc;
char *argv[];
#endif

{
int status = 0;  

   .....
   ......
  /* stuff deleted here */
   .....
   .....

#ifdef ANSI

int getDocInfo(void)
#else

int getDocInfo()
#endif

{

/* SQL stmt #6
exec sql begin declare section;
*/
int status = 0;
int len = 0;
char error_msg[120];
/* SQL stmt #7
exec sql end declare section;
*/

        
        getBaseOrg();

        /* initialize the length  of each output varchar  */

          updateNum.len = 10;
          updateDate.len  = 10;
          lduNum.len = 10;
          lduDate.len = 10;
          orgNum.len  = 7;
          orgName.len = 41;
          polTitle.len = 256;
          polSubTitle.len = 256;


/* SQL stmt #8
        EXEC SQL EXECUTE

        DECLARE 
           missing_update exception;
           missing_org    exception;
           missing_policy exception;
           missing_insert exception;
           orgType        varchar(4);
        BEGIN
           :error_msg :=  'nothing happening';

           select update_number, to_char(date_changed, 'MM/DD/YY'),
                  nvl(ldu_number,'NONE'), to_char(date_changed, 'MM/DD/YY')
           into :updateNum, :updateDate, :lduNum, :lduDate
           from   opus.update_history
           where org_number = :baseOrg 
             and policy_code = :polCode
             and  policy_type = :polType
             and  policy_version = :polVersion
             and  date_changed = (select max(date_changed) 
                                  from opus.update_history
                                  where org_number = :baseOrg 
                                   and  policy_code = :polCode
                                   and  policy_type = :polType
                                   and  policy_version = :polVersion
                                 );
           
           if SQL%NOTFOUND  then -- no such record in update history
                raise missing_update;
           end if;


           select org_number, org_name, org_type
           into :orgNum, :orgName, orgType 
           from opus.organization
           where org_number = :baseOrg;

           if sql%rowcount = 0 then -- illeagal organization
                raise missing_org;
           end if;

           select policy_name, policy_name_2 
           into :polTitle, :polSubTitle
           from  opus.policy_name
           where policy_code = :polCode 
             and org_type = orgType;

           if sql%rowcount = 0 then  -- illegal policy
              raise  missing_policy;
           end if;

           :status := 1; 


      EXCEPTION -- begining exception handling
          when missing_update then
              :status := 1;
              :error_msg := 'no record found in update_history'; 
          when missing_org then
              :status := 1;
              :error_msg := 'no record found in organization';
          when missing_policy then
              :status := 1;
              :error_msg := 'no record found in policy_name';
          when missing_insert  then
              :status := 1;
              :error_msg := 'error insert';
          when others  then
              :status := 1;
              :error_msg := 'error found in pl/sql block';

      END;    

    END-EXEC;
*/
{

        sqlbuf(
          "DECLARE MISSING_UPDATE EXCEPTION;MISSING_ORG EXCEPTION;MISSING_POLICY EXCEPTION;MISSING_INSERT EXCEPTION;ORGTYPE VARCHAR(4);BEGIN:b1:='nothing happening';SELECT UPDATE_NUMBER,TO_CHAR(DATE_CHANGED,'MM/DD/YY'),NVL(LDU_NUMBER,'NONE'),TO_CHAR(DATE_CHAN
GED,'MM/DD/YY')INTO:b2,:b3,:b4,:b5 FROM OPUS.UPDATE_HISTORY WHERE ORG_NUMBER=:b6 AND POLICY_CODE=:b7 AND POLICY_TYPE=:b8 AND POLICY_VERSION=:b9 AND DATE_CHANGED=(SELECT MAX(DATE_CHANGED)FROM OPUS.UPDATE_HISTORY WHERE ORG_NUMBER=:b6 AND POLICY_CODE=:b7 AND POLICY_TYPE=:b8 AND POLICY_VERSION=:b9);IF SQL% NOTFOUND THEN RAISE MISSING_UPDATE;END IF;SELECT ORG_NUMBER,ORG_NAME,ORG_TYPE INTO:b10,:b11,ORGTYPE FROM OPUS.ORGANIZATION WHERE ORG_NUMBER=:b6;IF SQL% ROWCOUNT=0 THEN RAISE MISSING_ORG;END IF;SELECT POLICY_NAME,POLICY_NAME_2 INTO:b12,:b13 FROM OPUS.POLICY_NAME WHERE POLICY_CODE=:b7 AND ORG_TYPE=ORGTYPE;IF SQL% ROWCOUNT=0 THEN RAISE MISSING_POLICY;END IF;:b14:=1;EXCEPTION WHEN MISSING_UPDATE THEN:b14:=1;:b1:='no record found in update_history'");
        sqlstm.stmt = ";WHEN MISSING_ORG THEN:b14:=1;:b1:='no record found in organization';WHEN MISSING_POLICY THEN:b14:=1;:b1:='no record found in policy_name';WHEN MISSING_INSERT THEN:b14:=1;:b1:='error insert';WHEN OTHERS THEN:b14:=1;:b1:='error found in pl/sql block';END;";
        sqlstm.iters = (unsigned short)1;
        sqlstm.offset = (unsigned short)25;
        sqlstm.cud = sqlcud0;
        sqlstm.sqlest = (unsigned char *)&sqlca;
        sqlstm.sqlety = (unsigned short)0;
        sqlstm.sqhstv[0] = (unsigned char *)error_msg;
        sqlstm.sqhstl[0] = (unsigned long)120;
        sqlstm.sqindv[0] = (short *)0;
        sqlstm.sqhstv[1] = (unsigned char *)&updateNum;
        sqlstm.sqhstl[1] = (unsigned long)12;
        sqlstm.sqindv[1] = (short *)0;
        sqlstm.sqhstv[2] = (unsigned char *)&updateDate;
        sqlstm.sqhstl[2] = (unsigned long)12;
        sqlstm.sqindv[2] = (short *)0;
        sqlstm.sqhstv[3] = (unsigned char *)&lduNum;
        sqlstm.sqhstl[3] = (unsigned long)12;
        sqlstm.sqindv[3] = (short *)0;
        sqlstm.sqhstv[4] = (unsigned char *)&lduDate;
        sqlstm.sqhstl[4] = (unsigned long)12;
        sqlstm.sqindv[4] = (short *)0;
        sqlstm.sqhstv[5] = (unsigned char *)&baseOrg;
        sqlstm.sqhstl[5] = (unsigned long)9;
        sqlstm.sqindv[5] = (short *)0;
        sqlstm.sqhstv[6] = (unsigned char *)&polCode;
        sqlstm.sqhstl[6] = (unsigned long)8;
        sqlstm.sqindv[6] = (short *)0;
        sqlstm.sqhstv[7] = (unsigned char *)&polType;
        sqlstm.sqhstl[7] = (unsigned long)6;
        sqlstm.sqindv[7] = (short *)0;
        sqlstm.sqhstv[8] = (unsigned char *)&polVersion;
        sqlstm.sqhstl[8] = (unsigned long)7;
        sqlstm.sqindv[8] = (short *)0;
        sqlstm.sqhstv[9] = (unsigned char *)&orgNum;
        sqlstm.sqhstl[9] = (unsigned long)9;
        sqlstm.sqindv[9] = (short *)0;
        sqlstm.sqhstv[10] = (unsigned char *)&orgName;
        sqlstm.sqhstl[10] = (unsigned long)43;
        sqlstm.sqindv[10] = (short *)0;
        sqlstm.sqhstv[11] = (unsigned char *)&polTitle;
        sqlstm.sqhstl[11] = (unsigned long)258;
        sqlstm.sqindv[11] = (short *)0;
        sqlstm.sqhstv[12] = (unsigned char *)&polSubTitle;
        sqlstm.sqhstl[12] = (unsigned long)258;
        sqlstm.sqindv[12] = (short *)0;
        sqlstm.sqhstv[13] = (unsigned char *)&status;
        sqlstm.sqhstl[13] = (unsigned long)4;
        sqlstm.sqindv[13] = (short *)0;
        sqlstm.sqphsv = sqlstm.sqhstv;
        sqlstm.sqphsl = sqlstm.sqhstl;
        sqlstm.sqpind = sqlstm.sqindv;
        sqlcex(&sqlctx, &sqlstm, &sqlfpn);
}

/* SQL stmt #9

       exec sql commit;
*/
{

       sqlstm.iters = (unsigned short)1;
       sqlstm.offset = (unsigned short)92;
       sqlstm.cud = sqlcud0;
       sqlstm.sqlest = (unsigned char *)&sqlca;
       sqlstm.sqlety = (unsigned short)0;
       sqlcex(&sqlctx, &sqlstm, &sqlfpn);
}
       fprintf(stdout,"%s,%d\n", lduNum.arr, lduNum.len); 
       fprintf(stdout, "%s,%d\n", updateNum.arr, updateNum.len);



        fprintf(stdout, "%s\n", error_msg);
        return(status);

} Received on Thu Feb 29 1996 - 00:00:00 CET

Original text of this message