473,241 Members | 1,580 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,241 software developers and data experts.

Problem in executing dynamic query with context in PRO *C program

Hi All,
I am facing problem in executing one dynamic query in PRO *C program
on linux. I want to update table
mytable by data MADURAI for a column mycolumn1 where primary key is
myPK.I want to use
EXECUTE IMMEDIATE with context.But it is not working.
Following is my piece of code. Please help. Thanks in advance.

int main()
{
EXEC SQL BEGIN DECLARE SECTION;
sql_context cntxt;
VARCHAR hDbName[32];
VARCHAR query[2000];
EXEC SQL END DECLARE SECTION;

EXEC SQL CONTEXT ALLOCATE :cntxt;

//Connected with database in another function passing context
as one argument. By using :-

connect_fun(cntxt,user,paswd);

strcpy((char *)query.arr,"UPDATE mytable SET
mycolumn1='MADURAI' WHERE myPK='11' ");
query.len=strlen("UPDATE mytable SET mycolumn1='MADURAI' WHERE
myPK='11' ");
EXEC SQL CONTEXT USE:cntxt;

//EXEC SQL AT :hDbName EXECUTE IMMEDIATE :query;
If I use this statement than ORA error is "statement handle not
prepared".

//EXEC SQL EXECUTE IMMEDIATE :query;
If I use this statement than ORA(1012) error is "not logged
on".

EXEC SQL AT :hDbName COMMIT;

return 0;

}
int connect_fun(sql_context cntxt,char *user, char *paswd)
{

EXEC SQL CONTEXT USE:cntxt;

EXEC SQL CONNECT :user IDENTIFIED BY :paswd AT :hdbname USING
:hdbname;

return 0;
}

Oct 9 '06 #1
2 4629

chets wrote:
I am facing problem in executing one dynamic query in PRO *C program
on linux.
Then you'd do better asking on an appropriate newsgroup. This one is
about the C programming language...

A newsgroup in the comp.databases.oracle hierarchy would be _much_ more
appropriate.

Oct 9 '06 #2
chets wrote:
Hi All,
I am facing problem in executing one dynamic query in PRO *C program
on linux. I want to update table
mytable by data MADURAI for a column mycolumn1 where primary key is
myPK.I want to use
EXECUTE IMMEDIATE with context.But it is not working.
Following is my piece of code. Please help. Thanks in advance.

int main()
{
EXEC SQL BEGIN DECLARE SECTION;
<snip>

I'm afraid that the bulk of this is not C but the major extensions that
Pro *C provides for handling SQL. We only deal with standard C not
something that uses C as a wrapper around vast quantities of other
stuff. You will have to ask somewhere that Pro *C is topical, and I'm
sure that there will be mailing lists dedicated to it if you look. You
could also try looking at SQL groups or groups dedicated to whatever SQL
engine it is that Pro *C works with, but check to see if Pro *C is
topical before posting to such groups.
--
Flash Gordon
Oct 9 '06 #3

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

Similar topics

8
by: Dima Protchenko | last post by:
Hi, guys. Please help if you know something about this. Error: ADODB.Recordset error '800a0e78' Operation is not allowed when the object is closed. line: if not rs.EOF then (from the code...
2
by: J.Bijleveld | last post by:
Hello colleagues, At this moment we have a real big problem using a .NET application with an Oracle database (v8.1.6). I hope someone has encountered this problem before and is able to help me...
1
by: Guinness Mann | last post by:
When you guys talk about "dynamic SQL," to what exactly are you referring? Is dynamic SQL anything that isn't a stored procedure? Specifically, I use ASP.NET to communicate with my SQL Server...
0
by: Srini | last post by:
I am implementing Front Controller in ASP.net as outlined in Microsoft documentation titled "Implementing Front Controller in ASP.NET Using HTTPHandler"...
11
by: Marco Loskamp | last post by:
Dear list, I'm trying to dynamically generate functions; it seems that what I really want is beyond C itself, but I'd like to be confirmed here. In the minimal example below, I'd like to...
2
by: Joseph Geretz | last post by:
I'm having a credentialing problem in my web application. Actually, I don't think this is an IIS security issue, since I'm able to access the page I'm requesting. However, the executing page itself...
8
by: Stephen Rice | last post by:
Hi, I have a periodic problem which I am having a real time trying to sort. Background: An MDI VB app with a DB on SQL 2000. I have wrapped all the DB access into an object which spawns a...
2
by: planetthoughtful | last post by:
Hi All, I'd like to place a subreport onto a report that draws its records from a UNION query. When I design the query and view the records all looks fine. However, when I put the query as...
10
by: jflash | last post by:
Hello all, I feel dumb having to ask this question in the first place, but I just can not figure it out. I am wanting to set my site up using dynamic urls (I'm assuming that's what they're...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
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: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
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...
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...

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.