473,385 Members | 1,356 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,385 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 10134

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...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.