473,287 Members | 1,447 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,287 software developers and data experts.

"EXEC SQL DESCRIBE SELECT LIST" returns "Specified partition does not exist"

Jan
I store sql-commands in a database table. In the first step I get the
sql command out of the database table with embedded sql. In the second
step I try to execute the command, which i got from the database
table, using dynamic sql.

Executing 'EXEC SQL DESCRIBE SELECT LIST FOR S INTO select_dp;' the
error code -2149 is returned That means "Specified partition does not
exist".

Does anybody know if it is a database problem or a problem of
precompilation?

I use the follwing arguments for precompilation:
PARSE=NONE VARCHAR=YES CODE=CPP FIPS=YES MODE=ANSI LINES=YES
OBJECTS=NO
PROGRAM till DECSCRIPE SELECT LIST:

/* getting the command from the database with embedded SQL
* and executing the command with dynamic SQL */
QtStringData*
DBCatalogAccess::execCommand(const char* command) throw (r_Error)
{
const int alias_len = db->alias_len;
const int description_len = 255;

/* Maximum length of dynamic sql statement.
It must be the same as len(dyn_statement) */
const int sql_com_len = 1024;

/* Definitons for dynamic sql*/
/* Maximum number of select-list items or bind variables. */
const int max_items = 40;

/* Maximum lengths of the _names_ of the select-list items
or indicator variables */
const int max_vname_len = 30;
const int max_iname_len = 30;

/* Define NULL */
const int nul = 0;

//Declaration need to fetch the command
EXEC SQL BEGIN DECLARE SECTION;
// Define a host structure for the output values
// of a SELECT statement
struct comdat {
char alias[20]; //alias_len
char describtion[255]; //desciption_len
char sql_com[255]; //sql_com_len
} comStruct;
// Input host variables
char *comInput;
EXEC SQL END DECLARE SECTION;
comInput = (char*) malloc(strlen(command));
strncpy(comInput, command, strlen(command));

cout << "DBCatalogAccess::execCommand:Entered command name: " <<
command << endl << endl;
//getting the command
EXEC SQL SELECT alias, description, sqlcommand
INTO
:comStruct
FROM CATQUERY
WHERE ALIAS=:comInput;
//t->commit();
cout << "Neues 1 " << endl;
cout << "Errorcode: " << SQLCODE << endl;
// termnating if an error accures
if (SQLCODE!=0)
{
//Fehler-Code muss noch an Anwender weitergeleitet werden.
char* ret = itoa(SQLCODE);

return (new QtStringData
("ORACLE ERROR; Modul: reladmin; Class: DBCatalogAccess;
Function: execCommand;"));
}
//Aufrufen des SQL-Befehls
cout << "dbcatalogaccess.pc::execCommand:alias " << comStruct.alias
<< endl;
/************************************************** *********************************
*Starting with dynamic sql
************************************************** *********************************/
EXEC SQL INCLUDE sqlda;
EXEC SQL INCLUDE sqlca;

EXEC SQL BEGIN DECLARE SECTION;
char dyn_statement[1024];
EXEC SQL VAR dyn_statement IS STRING(1024);
EXEC SQL END DECLARE SECTION;

SQLDA *bind_dp;
SQLDA *select_dp;

/* Define a buffer to hold longjmp state info. */
jmp_buf jmp_continue;

/* A global flag for hte error routine */
int parse_flag = 0;

cout << "DBCatalog::execCommand:Allocating descriptors" << endl;
/* Allocate memory for the select an bind descriptors. */
if ((bind_dp = sqlaldt(SQL_SINGLE_RCTX, max_items, max_vname_len,
max_iname_len)) == (SQLDA *) 0)
return (new QtStringData("DBCatalogAccess::execCommand:Fehler beim
Speicherallocieren für bind_dp"));

if ((select_dp = sqlaldt(SQL_SINGLE_RCTX, max_items , max_vname_len,
max_iname_len)) == (SQLDA *) 0)
return (new QtStringData("DBCatalogAccess::execCommand:Fehler beim
Speicherallocieren für select_dp"));
select_dp->N = max_items;

/* Allocate the pointers to the indicator variables and the actual
data. */
int i;
for(i = 0; i < max_items; i++)
{
bind_dp->I[i] = (short *) malloc(sizeof(short));
select_dp->I[i] = (short *) malloc(sizeof(short));
bind_dp->V[i] = (char *) malloc(1);
select_dp->V[i] = (char *) malloc(1);
}

/* setting dynamic statement */
//dyn_statement = (char*) malloc(strlen(comStruct.sql_com));
cout << "SQL-statement: " << comStruct.sql_com << endl;
strncpy(dyn_statement, comStruct.sql_com,
strlen(comStruct.sql_com));

/* Prepare the statement und declare the cursor */
EXEC SQL PREPARE S FROM :dyn_statement;
EXEC SQL DECLARE C CURSOR FOR S;

/* Set the bind variables for any placeholders in the SQL statement.
*/
bind_dp->N = max_items;
EXEC SQL DESCRIBE BIND VARIABLES FOR S INTO bind_dp;
cout << "DESCRIBE BIND VARIABLES; ErrorCode: " << SQLCODE << endl;
/* Set the maximum number fo array elements in the descriptor to the
number found. */
bind_dp->N = bind_dp->F;

/* Get the value of each bind variable as a ...
* C[i] contains the length of the bind variable name used in the
SQL statement.
* S[i] contains the actual name of the bind variable used in the
SQL statement.
* L[i] will contain the length of the data value entered.
* V[i] will contain the address of the data value entered.
* T[i] is always set to 1 because in this program data values for
all bind
* variables are stored as strings in the database.
* I[i] will point to the indicator value, which is set to -1 when
the bind variable value is "null".
*/
if (bind_dp->F > 0)
{
cout << "Bind variable found. Setting bind variable...";

cout << "OK!" << endl;
}
else
{
cout << "No bind variable found" << endl;
}

EXEC SQL OPEN C USING DESCRIPTOR bind_dp;

/* Set the select list items (output variables) in the select list*/
select_dp->N = max_items;

EXEC SQL DESCRIBE SELECT LIST FOR S INTO select_dp;
cout << "DESCRIBE SELECT LIST; ErrorCode: " << SQLCODE << endl;
Jul 19 '05 #1
0 10126

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: tedsuzman | last post by:
----- def f(): ret = 2 exec "ret += 10" return ret print f() ----- The above prints '12', as expected. However,
3
by: Alessandro Brollo | last post by:
Far from a professional programmer, I'm simply a newbie Python user. Two basic questions: 1. I don't want to post banal questions about Python to main Python list. Does a "banal Python questions...
10
by: serge | last post by:
Using "SELECT * " is a bad practice even when using a VIEW instead of a table? I have some stored procedures that are identical with the difference of one statement in the WHERE clause. If I...
0
by: Dirk Försterling | last post by:
Hi all, a few days ago, I upgraded from PostgreSQL 7.2.1 to 7.4, following the instructions in the INSTALL file, including dump and restore. All this worked fine without any error (message). ...
10
by: Roy | last post by:
Judging from the sheer number of posts on this topic, I'm sensing this is a fairly common problem. Only problem is, I've tried just about every recommendation in all the posts I've found thus far...
21
by: comp.lang.tcl | last post by:
set php {<? print_r("Hello World"); ?>} puts $php; # PRINTS OUT <? print_r("Hello World"); ?> puts When I try this within TCL I get the following error:
2
by: xml0x1a | last post by:
How do I use exec? Python 2.4.3 ---- from math import * G = 1 def d(): L = 1 exec "def f(x): return L + log(G) " in globals(), locals() f(1)
0
by: Jan | last post by:
I store sql-commands in a database table. In the first step I get the sql command out of the database table with embedded sql. In the second step I try to execute the command, which i got from the...
3
by: moltendorf | last post by:
I copied the files from my "test" database on my old server (MySQL was not running) to my new server ("./mysql/data/test" folder), and after starting the server, SHOW TABLES; shows all of the tables...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.