Here’s something I learned about SQL*Plus today. If you want to create a variable in a script, you can use the COLUMN command. In the following script, 2 variables called HOST_NAME and DATABASE_NAME are created. Their values are filled in when the SELECT statement executes. col host_name new_value HOST_NAME col instance_name new_value DATABASE_NAME SELECT host_name, instance_name FROM v$instance; UPDATE table SET value = '&&HOST_NAME'
If you want to use the Ruby Oracle OCI driver with Ruby on Rails, you might run into problems with the configuration. In the database.yml file, the following should be used to specify the host : host: localhost/mydatabase The mydatabase part is the the name of your database. For the adapter ‘oci’ should be specified. The database, username and password fields should be filled in as usual. Thanks to Duane’s Brain for pointing that out.
MySql has some interesting additions to standard SQL to show paginated results : the LIMIT n OFFSET skip clause. The website http://troels.arvin.dk/db/rdbms/#select-limit-offset shows a way of doing this in Oracle.
Ruby is a scripting language, in the same league as Perl and Python. It is fully object-oriented, and comes batteries includes like Python, which means it comes with a full library installed by default. It is receiving a lot of attention these days due to the Ruby on Rails web application framework, which is indeed a very capable and surprisingly easy to use framework (probably more on this in a later article).
Sometimes you get some PDF files, from which you have to extract some data. A handy way of doing this is using the pdftotext utility. Here I’ll show you how to use it, using Python. The easiest way to do this, is to put the pdftotext program in the directory where your script is or in the path. You can then call it on your file. This is the Python code : import subprocess subprocess.
Copyright (c) 2024 Michel Hollands