25.5. Accessing databases
A common task among scripts is to access database systems to retrieve information. This type of process is ideal for here documents. You can do practically anything that you would normally do at the database prompt. This is not an exercise in databases, but to show you how here documents can be used to connect to other applications, and carry out tasks.
On one of our database systems the ‘select into’ gets turned off when the database is accessed from certain third party products. This means that certain databases cannot be used for any insertion of data or the creation of temporary tables.
To fix this problem a here document is used to connect into the database system, and a for loop will feed the here document with ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access