Pro*Cで「EXEC SQL AT」句のエラーについて
お世話になります。
Pro*CでのEXEC SQL AT句について、複数ユーザをログインして、ユーザを切り替え(?)しようと
したとき、記述の仕方によって、エラーになるケースとならないケースとあって、困っています。
下に示すソースコードの要点を説明しますと、「_select_usr」という関数で操作しようとするユーザを
切り替えしています。
この関数を用いて、1回目((1)と示す箇所)は正常に明示出来ますが、2回目((2)と示す箇所)は
次のエラーメッセージが出ます。
ORACLE ERROR msg => SQL-02122: データベースへ接続でのOPENまたはPREPAREが無効です。
そこで、(2)の箇所をコメントにして、(3)で示す箇所の記述を有効、つまり「_select_usr」関数の
呼び出しを無効にし、EXEC SQL AT句を直に書き込んで実行すると、正常に別のユーザを明示して
くれます。
要は、関数を用いて、ユーザの切り替えが出来る様にしたいのですが、正常に実行出来る方法が
ありましたら、ご教示頂きたく存じます。
よろしくお願い致します。
【環境仕様】
クライアントOS : Windows7 Professional SP1
Oracle : Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 (Linuxサーバ)
開発ツール : Microsoft Visual Studio 2005 Version 8.0.50727.42
Microsoft .NET Framework Version 2.0.50727 SP2
Microsoft Visual C++ 2005
Pro*C/C++(PC) : Pro*C/C++: Release 10.2.0.1.0
【ソースコード】
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "sqlca.h"
#include "sqlda.h"
void* db_error_handler_ptr();
extern void truncate_blank(char *a);
static char *current_dbn;
static FILE *fp;
static void _connect( char* uid, char* pwd, char* host, char* dbn )
EXEC SQL CONNECT :uid IDENTIFIED BY :pwd AT :dbn USING :host;
fprintf(fp, "connect scima[%s] sqlcode[%d]\n", uid, sqlca.sqlcode );
void _disconnect(char *dbn)
EXEC SQL WHENEVER SQLERROR CONTINUE;
EXEC SQL AT :dbn ROLLBACK WORK RELEASE;
fprintf(fp, "disconnect dbn[%s] sqlcode[%d]\n", dbn, sqlca.sqlcode );
void ora_sql_error(char *file, int line)
char buf[512], *all_msg;
int buf_len, msg_len;
if (sqlca.sqlcode == -1405) {
return;
} else {
buf_len = sizeof(buf);
sqlglm(buf, &buf_len, &msg_len);
buf[msg_len] = '\0';
fprintf(fp, "ORACLE ERROR msg => %s\n", buf );
static int selectusr( char* dbn, char* uid )
int rtn;
char u[56];
EXEC SQL AT :dbn SELECT USER INTO :u FROM DUAL;
rtn = 1;
if (sqlca.sqlcode != 0) {
if (sqlca.sqlcode == -1012) {
rtn = -1;
ora_sql_error(__FILE__, __LINE__);
} else {
rtn = 0;
truncate_blank(u);
strcpy( uid, u );
fprintf(fp, "select scima[%s]\n", uid );
return( rtn );
void main()
char* uid1="UID1";
char* pwd1="PWD1";
char* name1="orcl";
char* db_name1="DB1";
char* uid2="UID2";
char* pwd2="PWD2";
char* name2="orcl";
char* db_name2="DB2";
char u[56];
fp = fopen("***.txt", "w");
if( !fp ) exit( 1 );
connect( uid1, pwd1, name1, dbname1 );
connect( uid2, pwd2, name2, dbname2 );
/*** (1) ↓ ***/
if( selectusr( db_name1, u )!=0 ){
exit( 1 );
fprintf( fp, "current scima(1) : [%s] \n", u );
/*** (1) ↑ ***/
/*** (2) ↓ ***/
if( selectusr( db_name2, u )!=0 ){
exit( 1 );
fprintf( fp, "current scima(2) : [%s] \n", u );
/*** (2) ↑ ***/
/*** (3) ↓ ***/
EXEC SQL AT :db_name2 SELECT USER INTO :u FROM DUAL;
if (sqlca.sqlcode != 0) {
if (sqlca.sqlcode == -1012) {
ora_sql_error(__FILE__, __LINE__);
exit( 1 );
} else {
truncate_blank(u);
fprintf( fp, "current scima(3) : [%s] \n", u );
/*** (3) ↑ ***/
disconnect(dbname1);
disconnect(dbname2);
if(fp) fclose(fp);
}
Matsuoka様
ご教示有難うございました。
コンテキストの方法でやってみようかと思ったところ、社の者が、プリコンパイラのオプションhold_cursorを「yes」にしていたのを「no」に切り替えたら、出来たんだそうです。とりあえず、それでやってみますが、何か問題あれば、コンテキストの方法でやってみたいと思います。
有難うございました。
Similar Messages
-
Pro*C with Visual C++ - leaks memory with EXEC SQL CONTEXT FREE
Hello,
I am making an aplication with threads, using Visual C++ with Pro*C... and I have a problem when the aplication execute EXEC SQL CONTEXT FREE the memory reserved is not free.
this is my code:
#include <sqlca.h>
EXEC SQL BEGIN DECLARE SECTION;
sql_context ctx;
EXEC SQL END DECLARE SECTION;
EXEC SQL ENABLE THREADS;
EXEC SQL CONTEXT ALLOCATE :ctx;
EXEC SQL CONTEXT USE :ctx;
EXEC SQL COMMIT WORK RELEASE;
EXEC SQL CONTEXT FREE :ctx;
thanks in advanceHi!
I suppose to helping in solve your question is necessary see how your application is working with threads.
Can you print them also? -
Hi,
My ProC code works fine when I have Exec sql in it but when I include plsql block in it using EXEC SQL EXECUTE, it throws the following error:
/tmp/cc88UGZa.o(.text+0x2c0): In function `main':
: undefined reference to `ECPGget_sqlca'
I have included all these below header files:
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <sqlca.h>
#include <sqlda.h>
#include <sqlcpr.h>
and the path have been mentioned in pcscfg.cfg as well.
what can be the reason and the solution to this please? Help is appreciated.
Thanks in advance!
AshYou have to use 'BEGIN procedure_name END' in the execute statement while calling PL/SQL Procedures
EXEC SQL EXECUTE
DECLARE
BEGIN
END;
END-EXEC; -
Getting core dump when using EXEC SQL CLOSE
In my pro*c program , i have used a cursor to fetch the set of accounts.Once cursor is opened , code will perform set
of operation using fetched data and then cursor is closed. Between open and closing of cursor , i have used 23 EXEC
SQL CLOSE. For example i am copying the value of a to b using strlcpy between fetch and close cursor statement.If
returned value from strlcpy is greater than size of destination variable, then flow should not proceed , in that case I will
close the cursor using EXEC SQL CLOSE and return the flow to calling program. Similarly i have closed the cursor at
another 22 locations.
When i compile the code and run binary the core dump occurs. On analyzing the core it shows
t@null (l@8) terminated by signal SEGV (no mapping at the fault address)
0xffffffffffffffff: <bad address 0xffffffffffffffff>
dbx: core file read error: address 0xfc4ffe48 not in data space
Current function is dbMtBaseClass::Pswd_Change
7860 sqlcxt(&_dbMtCtx, &sqlctx, &sqlstm, &sqlfpn);
if I remove any of the three EXEC SQL CLOSE commands , core dump does not occurs.
It looks strange.Please help me to resolve the issue.In my pro*c program , i have used a cursor to fetch the set of accounts.Once cursor is opened , code will perform set
of operation using fetched data and then cursor is closed. Between open and closing of cursor , i have used 23 EXEC
SQL CLOSE. For example i am copying the value of a to b using strlcpy between fetch and close cursor statement.If
returned value from strlcpy is greater than size of destination variable, then flow should not proceed , in that case I will
close the cursor using EXEC SQL CLOSE and return the flow to calling program. Similarly i have closed the cursor at
another 22 locations.
When i compile the code and run binary the core dump occurs. On analyzing the core it shows
t@null (l@8) terminated by signal SEGV (no mapping at the fault address)
0xffffffffffffffff: <bad address 0xffffffffffffffff>
dbx: core file read error: address 0xfc4ffe48 not in data space
Current function is dbMtBaseClass::Pswd_Change
7860 sqlcxt(&_dbMtCtx, &sqlctx, &sqlstm, &sqlfpn);
if I remove any of the three EXEC SQL CLOSE commands , core dump does not occurs.
It looks strange.Please help me to resolve the issue. -
PRO*C에서 EMBEDDED SQL STATEMENTS를 사용해서 LOB DATATYPES에 접근하는 예제
제품 : PRECOMPILERS
작성날짜 : 2001-07-12
PRO*C에서 EMBEDDED SQL STATEMENTS를 사용해서 LOB DATATYPES에 접근하는 예제
==========================================================================
Pro*C에서 LOB를 사용하는 방법에는 다음 3가지가 있습니다.
(1) PL/SQL blocks에서 DBMS_LOB package를 이용하는 방법
(2) OCI function을 이용하는 방법
(3) Embedded SQL statements을 이용하는 방법
다음은 (3)번째 방법에 대한 pro*c에서 지원하는 명령어들입니다.
o APPEND: Appends lob value at the end of another LOB.
EXEC SQL LOB APPEND :src TO :dst;
o ASSIGN: Assigns LOB or BFILE locator to another.
EXEC SQL LOB ASSIGN :src TO :dst;
o CLOSE: Close LOB or BFILE.
EXEC SQL LOB CLOSE :src;
o COPY: Copy all or part of LOB value into another LOB.
EXEC SQL LOB COPY :amt FROM :src [AT :src_offset] TO :dst [AT dst_offset];
o CREATE TEMPORARY: Creates a temporary LOB.
EXEC SQL LOB CREATE TEMPORARY :src;
o ERASE: Erase the given amount of LOB data starting from a given offset.
EXEC SQL LOB ERASE :amt FROM :src [AT :src_offset];
o FILE CLOSE ALL: Closes all the BFILES open in the current session.
EXEC SQL LOB FILE CLOSE ALL;
o FILE SET: Set DIRECTORY alias and FILENAME in a BFILE locator.
EXEC SQL LOB FILE SET :file DIRECTORY = :alias, FILENAME = :filename;
o FREE TEMPORARY: Free the temporary space for the LOB locator.
EXEC SQL LOB FREE TEMPORARY :src
o LOAD FROM FILE: Copy all or part of BFIL into an internal LOB.
EXEC SQL LOB LOAD :amt FROM FILE :file [AT :src_offset]
INTO :dst [AT :dst_offset];
o OPEN: Open a LOB or BFILE for read or read/write.
EXEC SQL LOB OPEN :src [ READ ONLY | READ WRITE ];
o READ: Reads all or part of LOB or BFILE into a buffer.
EXEC SQL LOB READ :amt FROM :src [AT :src_offset]
INTO :buffer [WITH LENGTH :buffer];
o TRIM: Truncates the LOB vlaue.
EXEC SQL LOB TRIM :src to :newlen;
o WRITE: Writes contents of the buffer to a LOB.
EXEC SQL LOB WRITE [APPEND] [FIRST | NEXT | LAST | ONE ]
:amt FROM :buffer [WITH LENGTH :buflen] INTO :dst [AT :dst_offset];
o DESCRIBE: Retrieves the attributes from a LOB.
EXEC SQL LOB DESCRIBE :src GET attribute1 [{, attributeN}]
INTO :hv1 [[INDICATOR] :hv_ind1] [{, :hvN [[INDICATOR] :hv_indN] }];
Attributes can be any of the following:
CHUNKSIZE: chunk size used to store the LOB value
DIRECTORY: name of the DIRECTORY alias for BFILE
FILEEXISTS: whether BFILE exists or not
FILENAME: BFILE name
ISOPEN: whether BFILE with this locate is OPEN or not
ISTEMPORARY: whether specified LOB is temporary or not
LENGTH: Length of BLOBs and BFILE in bytes, CLOBs and NCLOBs
in characters.
다음은 LOB를 사용하는 sample을 실행하는 방법입니다.
1. 먼저 scott user에서 다음을 실행합니다. (create directory를 할 수 있는 권한이
있어야 하며, directory는 사용하시는 환경에 맞도록 수정해 주십시요.)
drop table lob_table;
create table lob_table (key number, a_blob BLOB, a_clob CLOB);
drop table lobdemo;
create table lobdemo (key number, a_blob BLOB, a_bfile BFILE);
drop directory dir_alias;
create directory dir_alias as '/users/app/oracle/product/8.1.7/precomp/demo/proc';
insert into lob_table values(1, utl_raw.cast_to_raw('1111111111'), 'aaaaaaaa');
commit;
2. 다음 코드는 out.gif 파일을 위에서 지정한 directory에 만들고 lob_table의
내용에 들어있는 BLOB의 내용을 저장하는 sample입니다.
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <sqlda.h>
#include <sqlcpr.h>
/* Define constants for VARCHAR lengths. */
#define UNAME_LEN 20
#define PWD_LEN 40
/* Declare variables. No declare section is
needed if MODE=ORACLE. */
VARCHAR username[UNAME_LEN]; /* VARCHAR is an Oracle-supplied struct */
varchar password[PWD_LEN]; /* varchar can be in lower case also. */
/* The following 3 lines avoid inclusion of oci.h during precompilation
oci.h is needed only during compilation to resolve calls generated by
the precompiler
#ifndef ORA_PROC
#include <oci.h>
#endif
#include <sqlca.h>
OCIBlobLocator *blob;
OCIClobLocator *clob;
FILE *fp;
unsigned int amt, offset = 1;
#define MAXBUFLEN 5000
unsigned char buffer[MAXBUFLEN];
EXEC SQL VAR buffer IS RAW(MAXBUFLEN);
/* Declare error handling function. */
void sql_error(msg)
char *msg;
char err_msg[128];
size_t buf_len, msg_len;
EXEC SQL WHENEVER SQLERROR CONTINUE;
printf("\n%s\n", msg);
buf_len = sizeof (err_msg);
sqlglm(err_msg, &buf_len, &msg_len);
printf("%.*s\n", msg_len, err_msg);
EXEC SQL ROLLBACK RELEASE;
exit(EXIT_FAILURE);
void main()
/* Connect to ORACLE--
* Copy the username into the VARCHAR.
strncpy((char *) username.arr, "SCOTT", UNAME_LEN);
/* Set the length component of the VARCHAR. */
username.len =
(unsigned short) strlen((char *) username.arr);
/* Copy the password. */
strncpy((char *) password.arr, "TIGER", PWD_LEN);
password.len =
(unsigned short) strlen((char *) password.arr);
/* Register sql_error() as the error handler. */
EXEC SQL WHENEVER SQLERROR DO sql_error("ORACLE error--\n");
/* Connect to ORACLE. Program will call sql_error()
* if an error occurs when connecting to the default database.
EXEC SQL CONNECT :username IDENTIFIED BY :password;
printf("\nConnected to ORACLE as user: %s\n", username.arr);
/* Allocate the LOB host variables and select the BLOB value */
EXEC SQL ALLOCATE :blob;
EXEC SQL ALLOCATE :clob;
EXEC SQL SELECT a_blob INTO :blob FROM lob_table WHERE key=1;
/* Open external file to which BLOB value should be written */
fp = fopen("out.gif", "w");
EXEC SQL WHENEVER NOT FOUND GOTO end_of_lob;
amt = 5000;
EXEC SQL LOB READ :amt FROM :blob AT :offset INTO :buffer;
fwrite(buffer, MAXBUFLEN, 1, fp);
EXEC SQL WHENEVER NOT FOUND DO break;
/* Use polling method to continue reading the next pieces */
while (TRUE)
EXEC SQL LOB READ :amt FROM :blob INTO :buffer;
fwrite(buffer, MAXBUFLEN, 1, fp);
end_of_lob:
fwrite(buffer, amt, 1, fp);
printf("\nG'day.\n\n\n");
/* Disconnect from ORACLE. */
EXEC SQL ROLLBACK WORK RELEASE;
exit(EXIT_SUCCESS);
3. 다음 코드는 위에서 만든 out.gif file을 lobdemo에 저장하는 sample입니다.
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <sqlda.h>
#include <sqlcpr.h>
/* Define constants for VARCHAR lengths. */
#define UNAME_LEN 20
#define PWD_LEN 40
/* Declare variables. No declare section is
needed if MODE=ORACLE. */
VARCHAR username[UNAME_LEN]; /* VARCHAR is an Oracle-supplied struct */
varchar password[PWD_LEN]; /* varchar can be in lower case also. */
/* The following 3 lines avoid inclusion of oci.h during precompilation
oci.h is needed only during compilation to resolve call generated by
the precompiler
#ifndef ORA_PROC
#include <oci.h>
#endif
#include <sqlca.h>
OCIBlobLocator *blob;
OCIBFileLocator *bfile;
char *alias = "DIR_ALIAS";
char *filename = "out.gif";
unsigned int amt = 50;
unsigned int filelen;
/* Declare error handling function. */
void sql_error(msg)
char *msg;
char err_msg[128];
size_t buf_len, msg_len;
EXEC SQL WHENEVER SQLERROR CONTINUE;
printf("\n%s\n", msg);
buf_len = sizeof (err_msg);
sqlglm(err_msg, &buf_len, &msg_len);
printf("%.*s\n", msg_len, err_msg);
EXEC SQL ROLLBACK RELEASE;
exit(EXIT_FAILURE);
void main()
/* Connect to ORACLE--
* Copy the username into the VARCHAR.
strncpy((char *) username.arr, "SCOTT", UNAME_LEN);
/* Set the length component of the VARCHAR. */
username.len =
(unsigned short) strlen((char *) username.arr);
/* Copy the password. */
strncpy((char *) password.arr, "TIGER", PWD_LEN);
password.len =
(unsigned short) strlen((char *) password.arr);
/* Register sql_error() as the error handler. */
EXEC SQL WHENEVER SQLERROR DO sql_error("ORACLE error--\n");
/* Connect to ORACLE. Program will call sql_error()
* if an error occurs when connecting to the default database.
EXEC SQL CONNECT :username IDENTIFIED BY :password;
printf("\nConnected to ORACLE as user: %s\n", username.arr);
/* Allocate the LOB locator */
EXEC SQL ALLOCATE :blob;
EXEC SQL ALLOCATE :bfile;
/* Initialize the DIRECTORY alias of the BFILE and FILENAME */
EXEC SQL LOB FILE SET :bfile
DIRECTORY = :alias, FILENAME = :filename;
EXEC SQL INSERT INTO lobdemo values (1, EMPTY_BLOB(), :bfile);
EXEC SQL SELECT a_blob, a_bfile INTO :blob, :bfile FROM lobdemo
WHERE key = 1;
EXEC SQL LOB OPEN :bfile;
/* Get the BFILE length */
EXEC SQL LOB DESCRIBE :bfile
GET LENGTH INTO :filelen;
printf("File length is: %d\n", filelen);
amt = filelen;
/* Read BFILE and write to BLOB */
EXEC SQL LOB LOAD :amt FROM FILE :bfile INTO :blob;
EXEC SQL LOB CLOSE :bfile;
printf("\nG'day.\n\n\n");
/* Disconnect from ORACLE. */
EXEC SQL COMMIT WORK RELEASE;
exit(EXIT_SUCCESS);
4. 다음은 실행한 결과 입니다.
첫번째 sample :
Connected to ORACLE as user: SCOTT
G'day.
두번째 sample :
Connected to ORACLE as user: SCOTT
File length is: 10
G'day. -
Why do i have to init a VARCHAR for a SELECT in a Pro*C PL/SQL block?
Hi,
i use PL/SQL Block in a Embedded C Programm and compile with the PRO*C Compiler. Oracle 10gR2.
When i Select .. Into a VARCHAR bind variable, i have to initialize the variable before, otherwise i get an ORA-1458.
Same problem with assignments to VARCHAR variables.
Question: why do i need to initialize the variable?
Tnx for your help!
The following test program shows my issue:
#include <stdio.h>
#include <string.h>
#include "oraca.h"
#include "sqlca.h"
#define USER "scott"
#define PASSWORD "tiger"
int main()
EXEC SQL BEGIN DECLARE SECTION;
char *db_user = USER;
char *db_passw = PASSWORD;
VARCHAR sysdate_str[64];
EXEC SQL END DECLARE SECTION;
EXEC SQL CONNECT :db_user identified by :db_passw;
/* this works */
sysdate_str.len = 1000; /* invalid length */
EXEC SQL SELECT
to_char( sysdate, 'dd.mm.yy hh24:mi:ss' )
into :sysdate_str
from DUAL
printf ("sqlca.sqlcode %d\n", sqlca.sqlcode);
/* following code does not work, sqlcode = - 1458 */
/* 01458, 00000, "invalid length inside variable character string" */
sysdate_str.len = 1000; /* invalid length */
EXEC SQL EXECUTE
BEGIN
select to_char( SYSDATE, 'dd.mm.yy hh24:mi:ss')
into :sysdate_str
from dual;
END;
END-EXEC;
printf ("sqlca.sqlcode %d\n", sqlca.sqlcode);
/* following code does not work, sqlcode = - 1458 */
/* 01458, 00000, "invalid length inside variable character string" */
sysdate_str.len = 1000; /* invalid length */
EXEC SQL EXECUTE
BEGIN
:sysdate_str := to_char( SYSDATE, 'dd.mm.yy hh24:mi:ss');
END;
END-EXEC;
printf ("sqlca.sqlcode %d\n", sqlca.sqlcode);
return(0);
Edited by: jjaeckel on May 5, 2010 8:37 PMjjaeckel wrote:
When i Select .. Into a VARCHAR bind variable, i have to initialize the variable before, otherwise i get an ORA-1458.A bind variable in a SQL is simply a place holder. The SQL engine has no idea what data type the value for that placeholder will be. When itself needs to return a value via that placeholder to the caller, it needs to know what the limits/size of the caller's variable is that will be receiving the value from it.
The way that the SQL engine knows what the data type and size are of a placeholder/bindvar, is by you the caller, telling it.. by binding the variable you will be using, to this placeholder.
This bind process "exposes" the data type and size of the variable that will be used for binding (sending/receiving data). -
Using #include or EXEC SQL include
Hi
I havent much worked with Pro C so I have question
I need to modify a Pro C file to include a new lib,
So is it better to use:
EXEC SQL INCLUDE multibyte_chars.ph;
OR
#include "multibyte_chars.ph"Are both basically doing the same thing?
Please replyHi,
Pro C is not a Sun Studio product.
Searched google.com, found this Oracle FAQ: Pro *C:
http://www.db.cs.ucdavis.edu/public/oracle/faq/proc.html
Rose -
PRO*C 에서 PL/SQL 을 CALL 하기
제품 : PRECOMPILERS
작성날짜 : 1997-12-14
pl/sql 을 call 하는 방법은 다음과 같습니다.
stored procedure call하는 방법
=================================
pl/sql program 이름이 demo_package 안의 procedure_name 라면
EXEC SQL EXECUTE
begin
demo_package.procedure_name (:empno, :deptno) ;
end;
END-EXEC ;
function call 하는 방법 :
======================
pro*c 에서 pl/sql block 을 call 하고 , 실행하는 방법은 다음과 같다 .
EXEC SQL EXECUTE
DECLARE
var1 NUMBER;
BEGIN
var1 := function_name(:param);
END;
END-EXEC
이때 precompile option SQLCHECK=semantics, USERID=scott/tiger 를
주어야 합니다.Echo Justin's comment that what you want to do is very unusual.. as pretty much everything you can do in Pro*C, can these days be done using PL/SQL inside Oracle.. so why then, from PL/SQL, call Pro*C?
Besides the options listed by Justin, there's also EXT PROC that allows the definition of external procedures. In this case the Pro*C code needs to be shared object/dynamic link library.
Examples posted in OTN threads Re: Problem with external procedure and Unix Command run successfully through PL/SQL but showing no impact in UNIX.. -
SQL error 3113 occurred when executing EXEC SQL.
Hi,
We are facing one typical problem, One background is failing regularly with
below dump. as we now got all notes giving information, if database restarted
taking backup, these type of failures occur, but our database is only down for backup once in a week, but it is failing with frequenly.
in this two servers are located in different place, in this job tries to connect
another server to get material statistics.
It is giving some error message in sm21 with
SQL error 3113 occurred when executing EXEC SQL.
work procees in reconnect mode.
all notes saying these types of dump occur when database restared, but this dump
even though database is up.
below is short dump, please can anyone help me from this problem.
ABAP runtime errors DBIF_DSQL2_SQL_ERROR
Occurred on 08.01.2007 at 00:30:28
>> Short dump has not been completely stored. It is too big.
SQL error 3113 occurred when executing EXEC SQL.
What happened?
The error occurred in the current database connection "AZ1".
What can you do?
Note the actions and input that caused the error.
Inform your SAP system administrator.
You can print out this message by choosing "Print". Transaction ST22
allows you to display and manage termination messages, including keeping
them beyond their normal deletion date.
Error analysis
How to correct the error
Database error text........: "ORA-03113: end-of-file on communication channel#"
Triggering SQL statement...: "select mara.groes, mara.brgew, mara.ntgew,
mara.gewei, mara.volum, mara.voleh, mara.mstae, mara.mstde, mara.prdha,
marc.matnr, marc.werks, marc.mmsta, marc.mmstd from sapr3.mara, sapr3.m
where sapr3.mara.mandt = sapr3.marc.mandt and sapr3.mara.matnr =
Internal call code.........: "[DBDS/NEW DSQL]"
Please check the entries in the system log (Transaction SM21).
If the error occurred in a non-modified SAP program, you may be
able to find a solution in the SAP note system.
If you have access to the note system yourself, use the following
search criteria:
"DBIF_DSQL2_SQL_ERROR"
"ZM2431216 " or "ZM2431216 "
"EXTRACT_GENERAL_DATA"
If you cannot solve the problem yourself, please send the
following documents to SAP:
1. A hard copy print describing the problem.
To obtain this, select the "Print" function on the current screen.
2. A suitable hardcopy prinout of the system log.
To obtain this, call the system log with Transaction SM21
and select the "Print" function to print out the relevant
part.
3. If the programs are your own programs or modified SAP programs,
supply the source code.
To do this, you can either use the "PRINT" command in th
print the programs using the report RSINCL00.
4. Details regarding the conditions under which the error o
or which actions and input led to the error.
System environment
SAP Release.............. "46C"
Application server....... "essceu3"
Network address.......... "172.19.119.198"
Operating system......... "AIX"
Release.................. "5.3"
Hardware type............ "00C7ADBD4C00"
Database server.......... "ukblx176"
Database type............ "ORACLE"
Database name............ "EU3"
Database owner........... "SAPR3"
Character set............ "es_ES.ISO8859-1"
SAP kernel............... "46D"
Created on............... "Jul 9 2006 20:26:33"
Created in............... "AIX 1 5 00447C4A4C00"
Database version......... "OCI_920__OCI_7_API "
Patch level.............. "2257"
Patch text............... " "
Supported environment....
Database................. "ORACLE 8.0.5.., ORACLE 8.0.6.., ORACLE
8.1.6.., ORACLE 8.1.7.., ORACLE 9.2.0.., ORACLE 10.2.0.."
SAP database version..... "46D"
Operating system......... "AIX 1 4, AIX 2 4, AIX 3 4, AIX 1 5, AIX 2 5, AIX 3
5, , System build information:, , LCHN :
841480"
User, transaction...
Client.............. 600
User................ "MPZMMES"
Language key........ "S"
Transaction......... " "
Program............. "ZM2431216 "
Screen.............. "SAPMSSY0 1000"
Screen line......... 6
Information on where termination occurred
The termination occurred in the ABAP/4 program "ZM2431216 " in
"EXTRACT_GENERAL_DATA".
The main program was "ZM2431216 ".
The termination occurred in line 980
of the source code of program "ZM2431216 " (when callin
The program "ZM2431216 " was started as a background jo
Source code extract
009500 mara.ntgew,
009510 mara.gewei,
009520 mara.volum,
009530 mara.voleh,
009540 mara.mstae,
009550 mara.mstde,
009560 mara.prdha,
009570 marc.matnr,
009580 marc.werks,
009590 marc.mmsta,
009600 marc.mmstd
009610 into :w_ops-groes,
009620 :w_ops-brgew,
009630 :w_ops-ntgew,
009640 :w_ops-gewei,
009650 :w_ops-volum,
009660 :w_ops-voleh,
009670 :w_ops-mstae,
009680 :w_ops-mstde,
009690 :w_ops-prdha,
009700 :w_ops-matnr,
009710 :w_ops-werks,
009720 :w_ops-mmsta,
009730 :w_ops-mmstd
009740 from sapr3.mara, sapr3.marc
009750 where sapr3.mara.mandt = sapr3.marc.mandt
009760 and sapr3.mara.matnr = sapr3.marc.matnr
009770 and sapr3.mara.mandt = :p_mandt
009780 and sapr3.mara.matnr = :w_ebs-matnr
009790 and sapr3.marc.werks = :p_owerks
> ENDEXEC.
009810 endform. " extract_general_data
009820 *&
009830 *& Form append_i_ops
009840 *&
009850 * Appends W_OPS to I_OPS
009860 *
009870 form append_i_ops.
009880 append w_ops to i_ops.
009890 endform. " append_i_ops
009900 *&
009910 *& Form extract_material_description
009920 *&
009930 * Extracts a Material Description from the remote database an
009940 * modifies the current record in I_OPS.
009950 *
009960 * >P_SPRAS Language Key
009970 *
009980 form extract_material_description using p_spras.
009990 EXEC sql performing set_langauge.
Contents of system fields
SY field contents..................... SY field contents............
SY-SUBRC 0 SY-INDEX 0
SY-TABIX 1 SY-DBCNT 1
SY-FDPOS 18 SY-LSIND 0
SY-PAGNO 0 SY-LINNO 1
SY-COLNO 1
Chosen variables
Name.......................... Contents.1........2........3....+..
W_EBS-PRAT4
2
0
W_OPS-GROES
22222222222222222222222222222222
00000000000000000000000000000000
W_OPS-BRGEW #######
0000000
000000C
W_OPS-NTGEW #######
0000000
000000C
regards,
krishnaiah.Hi,
This is usually a SERVER SIDE DATABASE PROBLEM or SQLNET LISTENER (server side) PROBLEM. The client side should initially be ignored and instead the server should be investigated. In rare cases, this can be caused by client
side memory or other resource problem, or a DLL version mismatch, but this is
unlikely.
Enlist the assistance of your DBA. Then reproduce the ORA-3113 error on your
client application. Ask your DBA to look at the database side Alert.log and
trace files and look for ANY activity. Any activity that coincides with your
ORA-3113 will be a clue.
REgards
Vinod -
Can window and aggregate SQL functions used in Pro*C embedded SQL?
It appears that the window functions such as dense_rank() over(partition by ... order by ...) are not available in Pro*C embedded SQL. Can somebody please confirm that that is really the case?
Thanks
Rawender GuronPlease refer to this thread: "Is this forum also used for Pro*'C Questions? "
Is this forum also used for Pro*'C Questions? -
Use Of "#EC CI_EXECSQL in ABAP with EXEC SQL. Statement giving Syntax Error
Dear Gurus,
I have encountered an issue while trying to remove warning for using Native SQL statement using pseudo comment "#EC CI_EXECSQL
The thing is like this -- i have used follwing native sql command in abap.
EXEC SQL.
CONNECT TO 'SURROUND_DB'
ENDEXEC.
Now when i am checking this code in code inspector it is showing a warning with information below
CA CL_CI_TEST_CRITICAL_STATEMENTS0006
Code Inspector
Critical Statements
Use of Native SQL
Authorization checks cannot be appropriately run using EXEC SQL and should be carried out at program level.
The message can be hidden using the pseudo-comment "#EC CI_EXECSQL
Use of exceptin handling section for that warning showing me to use :
The message can be hidden using pseudo
comment "#EC CI_EXECSQL
Now when I am using "#EC CI_EXECSQL in the abap like below :
EXEC SQL. "#EC CI_EXECSQL
CONNECT TO 'SURROUND_DB'
ENDEXEC.
It is giving syntax error
The text literal ""#EC CI_EXECSQL " is longer than 255
characters.Check whether it ends correctly.
Please provide the guideline to resolve this issue.
Thanks & regards
Saifur Rahaman.Hi Saifur,
You can remove the warning using the following syntax:
EXEC "#EC CI_EXECSQL
SQL.
CONNECT TO 'SURROUND_DB'
ENDEXEC.
At least, it worked fine for me when using OPEN CURSOR, SELECT, FETCH and so on statements.
The way to use the pseudo comment is not very intuitive, but at least for my examples worked fine.
I hope this may help you.
Best regards,
Edgardo G. König -
Hi All,
I am using EXEC SQL join in my ABAP report,but it is giving dump.could you please correct my following code?
START-OF-SELECTION.
CONCATENATE '%' pa_match '%' INTO tp_match.
EXEC SQL.
OPEN dbcur FOR
SELECT kunnr,name1, banks
FROM kna1 as a inner join
knbk as b
on akunnr = bkunnr
WHERE a.kunnr = b.kunnr and
upper(a~name1) LIKE :tp_match
ENDEXEC.
DO.
EXEC SQL.
FETCH NEXT dbcur INTO :wa_name1
ENDEXEC.
IF sy-subrc <> 0.
EXIT.
ENDIF.
APPEND wa_name1 TO ta_name1.
COLLECT wa_name1 INTO ta_name1.
ENDDO.
EXEC SQL.
CLOSE dbcur
ENDEXEC.Remove the 'As' from the statement
EXEC SQL.
OPEN dbcur FOR
SELECT kunnr,name1, banks
FROM kna1 a inner join "Delete 'AS' here
knbk b
on a~kunnr = b~kunnr
WHERE a.kunnr = b.kunnr and
upper(a~name1) LIKE :tp_match
ENDEXEC. -
Where can i set up connection in "exec sql"?
i have code block like this:
EXEC SQL.
SET CONNECTION :'PA'
ENDEXEC.
IF SY-SUBRC <> 0.
Connection not yet opened.
EXEC SQL.
CONNECT TO :'PA'
ENDEXEC.
IF SY-SUBRC <> 0.
write: / sy-msgid ,sy-msgno,sy-msgty,sy-msgv1,sy-msgv2,sy-msgv3,sy-msgv4.
write: / 'connect error'.
RAISE EXCEPTION TYPE cx_sy_native_sql_error.
ENDIF.
ENDIF.
where can i set up the 'PA'?thanks very much!!!!You set up new databse connection for SAP to communincate with using 'DBCO' tcode.
-
What does an EXEC SQL stmt do in ABAP? What is the disadvantage of using it
hi,
What does an EXEC SQL stmt do in ABAP? What is the disadvantage of using it?
regards.sorry, question resolved.
-
How to use INSERT in EXEC SQL ...... ENDEXEC ?
Hi,
The following code;
DATA: BEGIN OF str_insert,
a(3) TYPE c,
b(3) TYPE c,
END OF str_insert.
EXEC SQL.
SET CONNECTION DEFAULT
ENDEXEC.
str_insert-a = 'a'.
str_insert-b = 'b'.
EXEC SQL.
INSERT INTO ZSAP VALUES :str_insert
ENDEXEC.
The Structure of the ZSAP table (There is no data in ZSAP);
A CHAR 3 (Primary Key)
B CHAR 3
I cannot instert a record to this table it throughs the following error;
Runtime Errors DBIF_DSQL2_SQL_ERROR
Exceptn CX_SY_NATIVE_SQL_ERROR
How could use a structure to insert values into ZSAP?
Thanks,
KishanHello..
loop at T_PC.
loop at T_PCD .
at new NUMREFERENCIA.
exec sql.
INSERT INTO tblPolizaContableR3
(LibroMayor, PeriodoContable, Prefijo, NumReferencia,
Fecha, FuenteDiario, ComentarioPoliza, Moneda,
TipoCambio, RefExternaID1, RefExternaID2, RefExterna1,
RefExterna2, DescRefExterna)
VALUES (:T_PC-LIBROMAYOR, :T_PC-PERIODOCONTABLE,
:T_PC-PREFIJO, :T_PC-NUMREFERENCIA, :T_PC-FECHA,
:T_PC-FUENTEDIARIO, :T_PC-COMENTARIOPLIZA, :T_PC-MONEDA,
:T_PC-TIPOCAMBIO, :T_PC-REFEXTARNAID1, :T_PC-REFEXTERNAID2,
:T_PC-REFEXTERNA1, :T_PC-REFEXTERNA2, :T_PC-DESCREFEXTERNA)
endexec.
endat.
exec sql.
INSERT INTO tblPolizaContableDetR3
(LibroMayor, PeriodoContable, Prefijo, NumReferencia,
Partida, Cuenta, CuentaIMSA, CCostoIMSA,
Cargo, Abono, ComentarioPartida)
VALUES (:T_PCD-LIBROMAYOR, :T_PCD-PERIODOCONTABLE,
:T_PCD-PREFIJO, :T_PCD-NUMREFERENCIA, :T_PCD-PARTIDA,
:T_PCD-CUENTA, :T_PCD-CUENTAIMSA, :T_PCD-CCOSTOIMSA,
:T_PCD-CARGO, :T_PCD-ABONO, :T_PCD-COMENPARTIDA)
endexec.
endloop.
Hope this help you.
Regards, Gustavo Estrada
Maybe you are looking for
-
Is anyone else having trouble tracking their free bumper shipment?
For some reason, I am having the worst time trying to track my free bumper shipment. I got the shipment confirmation e-mail from Apple on 7/30 with an estimated delivery date of 8/6. For the first two days, I got no information when I clicked on the
-
How to prevent changing DNS server address
I work for a public school district. We just purchased our first batch of Win 8.1 PCs, but they are not the Pro version, so there is no gpedit. I want to prevent students from accessing the TCP/IPv4 Properties dialog box in order to ensure that the
-
FTE and volume based billing for a call center operations
hi, we have a call center handling operations only for intercompany customers (means no external customers). And we want to go for a solution based on two business processes. first one is FTE (Full time equivalent) and the second is volume based bill
-
How to block face book or orkut or any other websites
i want to block certains websites, which are harmful for children. Kindlhy inform how is it possible
-
Can I import Fuji X-E1 Raw Files
I cannot import RAW files from my FUJI X-E1 camera. Is there an update for this file type.