Skip to content

Tag: oracle

Retrieve Oracle last inserted IDENTITY

Since Oracle 12c we can use IDENTITY fields. Is there a way to retrieve the last inserted identity (i.e. select @@identity or select LAST_INSERTED_ID() and so on)? Answer Well. Oracle uses sequences and default values for IDENTITY functionality in 12c. Therefore you need to know about sequences for your quest…

How do I group “or” in pl/sql

I have legacy sql query that selects bit masks (among other data), something like: How do I group this output like: That should be 3 Answer In order to do bit-wise logic you have to do a “bit” of math. (Bad puns are free around here :-). Oracle defines the BITAND function. To get a bitwise ‘…

Running Oracle SQL query over several dates

Within Crystal Reports, I’m using the following query (against an Oracle database) to generate data for a single field in a report: This works fine and returns a single integer value, based on the {?HB_As_At_Date} supplied (The {?} syntax is Crystal’s way of embedding parameter values into SQL). T…

Can row_number() ignore null in oracle

I have data like this How can i write query to get row_number without counting null column. Answer Well, not specifically. But you can get what you want by using conditional logic: It is not clear to me what the order by is for the row_number() which is what the . . . means.

Order by case insensitive in oracle

I want to order a following text in following order but, after trying the following query it is not working. values to order is “A”, “B”, “Y”, “Z”, “a”, “b”, “y”, “z”. Expected result “ZzYyBbAa” …