• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1244
  • Last Modified:

Break error when using Pro*C insert

I have a very strange problem.

I have a Pro*c insert statement...

EXEC SQL INSERT INTO....

when I compile I get error

1506-056 (S) Break statement cannot be placed outside a while, do, for, or switch statement.

Not only does the line to which the error points not have a Break statement, there isnt even a break statement in the entire function!!

Anyone come across this before or have any suggestions about any debug I can do?

Julian
0
stummj
Asked:
stummj
  • 4
  • 4
  • 2
1 Solution
 
seazodiacCommented:
stummj:

check out this link , it has a nice intro about how to execute sql inside proc*c:

http://www-db.stanford.edu/~ullman/fcdb/oracle/or-proc.html 



0
 
seazodiacCommented:
I bet it's still some synax requirement you have not made it right ...
0
 
stummjAuthor Commented:
Ive looked in the *.c file and there is indeed a break statement in about the right area, but it isnt in the .pc file
Very strange.
0
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
stummjAuthor Commented:
follow up. I now think the fact that I have a break in the .c file is a red herring. It looks like every time a host variable is used, you get this statement at the end of the block...  if (sqlca.sqlcode == 1403) break;

0
 
earth man2Commented:
try defining the following
EXEC SQL WHENEVER SQLWARNING CONTINUE;
EXEC SQL WHENEVER SQLERROR CONTINUE;
0
 
earth man2Commented:
this is probably it add the following statement
EXEC SQL WHENEVER NOT FOUND CONTINUE;
0
 
stummjAuthor Commented:
Amazing!!! OK That works ... but why!
What is it not finding? It isnt a select its an insert.
0
 
earth man2Commented:
Pro*C is just a program it is just applying  macro processing to produce compilable c code.

If you havn't defined what to do WHENEVER NOT FOUND it is just expanding it's default rule into the c code.

You are supposing Pro*C is more sophisticated than it really is.
0
 
earth man2Commented:
From Oracle Docs
An INSERT can return NOT FOUND if no rows have been inserted.
0
 
stummjAuthor Commented:
Thanks Earthman - where did you find that in the Oracle Docs?
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 4
  • 4
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now