Tuesday, March 22, 2011

SQLPlus in a Here Document

This is called a 'here document' - because it says "here is the text for your input". The redirection expressed as "<<EOF" says "take what follows as though I typed it at the keyboard, until you find a token to match EOF as the first token on a line". The token EOF has no special meaning - it's just a string of characters used as a marker to tell the 'here document' when the text input is completed.

sqlplus <<EOF
      Select something
       from somewhere;
EOF

Important: the ending token must appear as the first characters on a line by itself.

Thanks to Jim Benz of Pittsburgh for these notes.


No comments:

Post a Comment