Skip navigation

Category Archives: SQL

Joining columns and results together is really easy in Oracle or MySQL, in both there is the same function – CONCAT().

However you should be aware that there are differences between the databases on how this function works. In MySQL the CONCAT() function works by joining any number of items specified in the function – I don’t think that there is a limit? But with Oracle it seems that you can only join two strings at a time using this function.

Joining columns/ concatenate strings in Oracle PLSQL/ MySQL

This is the equivalent code for writing a switch statement in Oracle. In Oracle to do the switch we use a function called case. Which looks for a value in the field specified, when it returns true it returns a value else returns a default. This has the same logic as writing an if statement pretty much, e.g. IF (value == “bob”) { do stuff } ELSE….

This is very very handy when having to do some reports and for instance the categories in your database don’t match up to what the report needs or you need combine a few columns together based on their values.

Writing basic case switch statements in Oracle PL/SQL

Ok so you want to upload a file to your webspace. Easy enough you just need some sort of server-side language. In this case it’s PHP, this tutorial should work with versions 4 upwards.

So we’ll build just 1 file to handle the upload, display status and the form.

Im going to call this upload0r.php (you can call it whatever you want)

First of all make a folder in your webspace/server called uploads, by default it should have read, write and execute permissions (chmod 777) if it doesn’t you can use something like Filezilla FTP client to alter this.

More here: Upload a File Using PHP

Quite useful, I had the case where I needed to provide a CSV file to an external party from our Oracle 10g database. No problem, there are loads of CSV export tools out there. But it then transpired that the CSV’s that I was generating were using quote (”) marks to identify fields e.g. “field1″,”field2″ and so on…
More below at my main blog site:
Spool a CSV file from Oracle/ SQL*Plus without quotes

Follow

Get every new post delivered to your Inbox.