Skip to content

Tag: oracle

Auto increment function, Oracle PL/SQL

I have a number of triggers which do various things, but at the top of all of those which have unique integer primary keys, I need them to auto increment. The code currently looks as follows: I thought it may be useful to make a small function for this, as I would if this were a conventional programming langu…

Handling Null in Greatest function in Oracle

I want to compare two dates from two columns and get the greatest and then compare against a date value. The two column can hold NULL values too. For example I want the below OUTPUT. How do I use the greatest function or if there is anything else? I am again using the output to compare against another date. A…

“Alter user sys identified by” not working

First of all, I use: Windows 7 x64 Oracle Enterprise 11g R2 x32 I have some basic experience with SQL Server and MySQL (more with MySQL). Today I started working with Oracle, and I’ve been bumping a lot on the way. The problem I’m having now is that, for some reason, I can’t connect to any s…

Oracle query to calculate current age

I want to calculate current age of person from DOB(date of birth) field in Oracle table. Data type of DOB field is varchar and the is date stored in format ‘DD-MON-YY’. when I calculate current age …

Weekday number regardless of the NLS settings

I’m looking for the simplest way to determine the weekday number for the DATE value in oracle independent of the NLS settings. Any ideas? Answer ISO weeks start on Monday; they don’t use NLS settings. I think this expression is reliable. To show how the arithmetic works . . . current_date is a Wed…