SQL Archive

  • Oracle: Update From equivalent

    Oracle: Update From equivalent

    Quick note on how to update data in a series of joined tables using a subquery in the UPDATE statement in Oracle, kind of like the UPDATE FROM in SqlServer. First of all check out the above diagram, I’ve stolen it from this link: http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14261/update_statement.htm...

    Project info

  • Writing basic case switch statements in Oracle PL/SQL

    Writing basic case switch statements in Oracle PL/SQL

    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....

    Project info

  • Spool a CSV file from Oracle/ SQL*Plus without quotes

    Spool a CSV file from Oracle/ SQL*Plus without quotes

    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...

    Project info

  • LIMIT equivalent for Oracle

    LIMIT equivalent for Oracle

    So you use MySQL etc… and you’re used to adding a LIMIT clause to your query for example, SELECT * FROM table WHERE name = ‘bob’ LIMIT 1 And now you’re using Oracle and want to do the same thing? But it throws some dread...

    Project info