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…
Tag: oracle
USE database_name command alternative for Oracle
what is the alternative of use database_name command of SQL server in oracle?
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…
Error (ORA-00923: FROM keyword not found where expected)
select country_olympic_name, SUM(part_gold) as ‘Number of Gold Medals’ From games.country, games.participation where participation.country_isocode = country….
“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…
Creating a new database and new connection in Oracle SQL Developer
I’ve installed SQL Developer on my system. No connections are being shown in my system yet. How do I create a new connection. Must I create a database first? If yes, then how do I create a new database. The SQL Query Editor window is not opening because there is no connection. All of this because there …
Query Oracle for 12 month moving total (SUM) of data
I need to run a query on some data that brings back the moving 12 month total. I’ve already performed the average function on the data… so now I just need to loop through and get a moving 12 month period of data and SUM it up so I can graph it. Below is the current query i’m issuing but
Oracle case inside where clause
This is a simple question, I’ve read some details about using CASE in WHERE clause, but couldn’t able to make a clear idea how to use it. The below is my sample query: 1 SELECT * FROM dual 2 …
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…