popular

Before updating a row in a database table, you might want to check for concurrency conflict – another transaction should not be updating the same row simultaneously.

This can be achieved by locking the row in Oracle before update. Here’s how.

[click to continue…]

{ 3 comments }

You can call a web service from PL/SQL using the Oracle-supplied package UTL_HTTP. Here’s a demo of calling a public web service that returns latest city weather by ZIP.

[click to continue…]

{ 5 comments }

A simple example of using UTL_FILE in PLSQL to create a file and write into it. Plus, the common ORA errors you encounter with the use of UTL_FILE, and how to resolve them.

[click to continue…]

{ 22 comments }

In an earlier post, we saw how Oracle SQL can be used to transpose data from rows to columns.

It is a similar, though simpler, exercise to transpose data from rows to comma-separated list, using Oracle’s built-in function LISTAGG.

[click to continue…]

{ 3 comments }

Oracle gives you a number of ways to know the name of the database you are connected to, from inside a SQL*Plus session. Here are three ways to find out your Oracle database name.

Through V$DATABASE

SQL> select name from V$database;

NAME
---------
XE

The above will work only if your login has access to V$DATABASE. This is generally accessible to DBA logins only. For non-DBA logins, you may need to grant SELECT on V$ views.

In case access to V$DATABASE cannot be granted to you, use one of the two publicly accessible methods below.

[click to continue…]

{ 4 comments }