×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Comments in Embedded SQL files???

Comments in Embedded SQL files???

Comments in Embedded SQL files???

(OP)
Hy,
does anybody know how I can insert comments into Embedded SQL files? Is it possible at all?

kind regards boaconstrictor  

RE: Comments in Embedded SQL files???

I'm not quite sure why a comment in embedded SQL would be different from a comment in regular SQL:

(example SQL block:)
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:

http://www.postgresql.org/idocs/index.php?sql-comment.html

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

Big Brother: "War is Peace" -- Big Business: "Trust is Suspicion"
(http://www.cl.cam.ac.uk/~rja14/tcpa-faq.html)

RE: Comments in Embedded SQL files???

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!

RE: Comments in Embedded SQL files???

(OP)
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!

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close