Archive for SQL

Returning the ID of a Newly Created Row in Oracle’s PL-SQL

Having years of background developing applications using MSSQL Server as the database, I encountered a roadblock when my stored procedure is required to return the id for my newly created row in oracle.

Immediate Work-Around

Since all my tables have a timestamp field, the most obvious thing to do is to query the topmost row of my table sorted by the timestamp field. For added accuracy, I also filtered my query against the userid which created the affected row.

Read the full article…

Comments off

Dynamically number rows in a SELECT T-SQL statement (SQL Server 2000)

I encountered some TSQL Select problem where I want my result set to have a “number” on the first column. If for example you have a simple select statement

USE Northwind
SELECT    CustomerID
,    CompanyName
FROM      Customers
ORDER BY  CustomerID

Read the full article…

Comments (2)