My Oracle Support Banner

RDBPROD: Third Element of the SQLERRD Array is Not Updated (Doc ID 94357.1)

Last updated on AUGUST 08, 2016

Applies to:

Oracle Rdb Server on OpenVMS - Version 6.1 and later
HP OpenVMS VAX
HP OpenVMS Alpha
HP OpenVMS Itanium

Symptoms

The third element of the SQLERRD array is not updated when you PREPARE a statement and only pass the SQLCODE. This is true even though you pass the entire SQLCA structure at EXECUTE time.

Example:

The following sample program works as expected against the sample MF_PERSONNEL database unless the SQLCODE only is passed and received on the PREPARE call. In this case the program prints "Number of records: 0" instead of "Number of records: 100".

Header file (SAMPLE_SQLMOD.H):

  extern void PREPARESTATEMENT (
                  void *SQLCA                                 /* out    */
                  ,char COMMAND[257]                          /* in     */
      );
  extern void EXECUTESTATEMENT (
                  void *SQLCA                                 /* out    */
      );

C Program:

  # include <stdio.h>
  # include <string.h>
  # include "sample_sqlmod.h"

  exec sql include sqlca;

  main() {
      char command[256];

      strcpy(command, "update employees set employee_id = employee_id");
      PREPARESTATEMENT(&SQLCA, command);
      EXECUTESTATEMENT(&SQLCA);
      printf("Number of records: %d\n", SQLCA.SQLERRD[2]);
  }

SQLMOD Routine:

------------------------------------------------------------------------
--- Header Information
------------------------------------------------------------------------
module erase_mod
  language c
  authorization sql_sample
------------------------------------------------------------------------
-- DECLARE Statements
------------------------------------------------------------------------
-- Pre Rdb V4.1 : declare schema authorization for filename SQL$DATABASE
declare alias for compiletime filename SQL$DATABASE
------------------------------------------------------------------------
-- Procedure (PrepareStatement)
------------------------------------------------------------------------
procedure PrepareStatement
  sqlca
  command char(256);
  prepare statement from command;
------------------------------------------------------------------------
-- Procedure (ExecuteStatement)
-------------------------------------------------------------------------
procedure ExecuteStatement
  sqlca;
  execute statement;

 

Cause

To view full details, sign in with your My Oracle Support account.

Don't have a My Oracle Support account? Click to get started!


My Oracle Support provides customers with access to over a million knowledge articles and a vibrant support community of peers and Oracle experts.