Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Comments in Embedded SQL files??? 1

Status
Not open for further replies.

boaconstrictor

Programmer
Feb 21, 2002
19
0
0
CH
Hy,
does anybody know how I can insert comments into Embedded SQL files? Is it possible at all?

kind regards boaconstrictor [ponder]
 
I'm not quite sure why a comment in embedded SQL would be different from a comment in regular SQL:

(example SQL block:)
Code:
CREATE SEQUENCE "id" start 1 increment 1 maxvalue 2147483647 minvalue 1  cache 1 ;

-- this is a comment

SELECT * FROM table_1;

-- here are a few comments
-- comment1
-- comment2

SELECT * FROM table_1
-- you can even have comments in the
-- middle of an SQL statement, as long
-- as you put them on their own lines
WHERE id > 12;

Or do you mean the SQL COMMENT syntax, where you can create a comment on a table, view, whatever, to be stored for later use? This should also work just fine in embedded SQL:

-------------------------------------------

Big Brother: "War is Peace" -- Big Business: "Trust is Suspicion"
(
 
Hi,

If you are embedding it in the C language, you could also used the '/* */' comments...

e.g.

EXEC SQL SELECT fname,lname /* SELECT .... */
INTO :hv_Fname,:hv_Lname
FROM EMPLOYEE /* EMPLOYEE TABLE */
WHERE idno=:hv_IDNo;

Good Luck!
 
Thanks for your answers!
I found out now what was wrong. The token "--" can be used in .pgc-files, but if you precompile this to a c-program, it produces "--" tokens as well in the c-file. But in C this is an unknown token. So if you use this token, you need to swap them into "/*" tokens.

Hence it is strongly recommended to use the standard C token "/*" and "*/" for comments inside the .pgc files.

But there is still a considerable issue:
The new C99 standard supports also the token "//" to make comments for one line. But the ECPG program doesn't recognise it as a comment token! This could be a pitfall!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top