oracle

Order of declaration in an anonymous pl/sql block

I have an anonymous pl/sql block with a procedure declared inside of it as well as a cursor. If I declare the procedure before the cursor it fails. Is there a requirement that cursors be declared prior to procedures? What other rules are there for order of declaration in a pl/sql block? This works: DECLARE cursor cur is select 1 fr...

using ansi sql syntax for formatting Numeric

Hi I am using two different databases for my project, Oracle and Apache Derby, and am trying as much as possible to use the ANSI SQL syntax supported by both of the databases. I have a table with a column amount_paid NUMERIC(26,2). My old code, which was using Oracle db, needed to retrieve value in this format SELECT LTRIM(TO...

Where to put conditionals in ANSI-syntax SQL queries

What's the difference between these two queries? I've been resistant to jumping on the ANSI-syntax bandwagon because I have not been able to unravel various syntactical ambiguities. Is 1) returning the product of the join and only then filtering out those joined records which have weight >= 500? And is 2) filtering out those prior to ...

How to filter rows on a complex filter

I have these rows in a table ID Name Price Delivery == ==== ===== ======== 1 apple 1 1 2 apple 3 2 3 apple 6 3 4 apple 9 4 5 orange 4 6 6 orange 5 7 I want to have the price at the third delivery (Delivery=3) or the last price if there's no third delivery. It would...

Usage of oracle function sys connect by path

We have a problem that it seens not supported in oracle 10g what could be the cause? ...

Comparing two Oracle schema, other users

Hello! I have been tasked with comparing two oracle schema with a large number of tables to find the structural differences in the schema. Up until know I have used the DB Diff tool in Oracle SQL Developer, and it has worked very well. The issue is that now I need to compare tables in a user that I cannot log into , but I can see it thro...

How to identify what locked PL/SQL package (Oracle 10.0.4.2)?

I was trying to recompile PL/SQL package and no avail. because something obtained the lock and that wasn't released for long time. As soon as I kill all sessions I was able to recompile but encounter the same behavior (i.e. locked package) and I wonder what tools are avail to identify what could of obtain it and never release it? This ...

Help with Oracle SQL Count function! =)

Hi guys.. The question I'm struggling with is this: I have a list of helicopter names in different charters and I need to find out WHICH helicopter has the least amount of charters booked. Once I find that out I need to ONLY display the one that has the least. I so far have this: SELECT Helicopter_Name , COUNT (Distinct Chart...

Number of args for stored procedure PLS-00306

Hi I have problem with calling for my procedure. Oracle scrams PLS-00306 Error: Wrong number of types of arguments in call to procedure. With my type declaration procedure has exact the same declaration like in header below. If I run it as separate procedure it works, when i work in ODCI interface for extensible index creation, i...

SQL Where clause in ORACLE

How can i use the END_DATE/START_DATE from the first sub select in the second subselect?, the provided values are only examples. (06/01/2010). SELECT "PROJECT"."ID", "PROJECT"."CLIENT", "PROJECT"."NAME", "PROJECT"."STATE", "PROJECT"."EARLIEST_START", "PROJECT"."LATEST_END", "PROJECT"...

Using NVL function in SQL, please help!

I'm needing to select first and last name in a table which is working fine in the following SQL, but the part that isn't working is the NVL function. The file should show all pilots at a company that fly helicopters and IF they don't have a licence the field HT_NAME should come up as 'N/A' and the field for end hours flown should be 0. I...

Create Oracle Function by checking increment value

How to check in Oracle Function whether value is increasing in particular field for last 3 year or not. Suppose one table is company and if we want to consider only values if profit of past 3 year of company is in increasing manner. ...

Import fixed width file to oracle

Is there an ability to import fixed width file to oracle? Preferably through .net(c#) for catching errors during import and showing them to user. P.S. File has 5 types of rows. For example 1 row has 5 columns, 2-nd has 50 columns. ...

Oracle SQLPlus: How to display the output of a sqlplus command without having to first issue the spool off command?

Is there a way to display the output of a sqlplus command without having to first issue the spool off command? I am spooling the results of a sqlplus session to a file while at the same time tailing the file. The reason for this is that for table with very long rows the format is easier to look at from a file. The problem is to see the...

Standard Apache (not OHS) with mod_osso for Single Signon

The mod_osso.so (the Apache plugin for Single Signon, provided by Oracle) is distributed with the Oracle HTTP Server (OHS), which is essentially a modified Apache. I am trying to use it on the standard Apache HTTP Server, and have not managed to get it to work. Configuration: Apache 2.2.15 OHS from the Oracle Web Tier Tools 11.1.1.2....

Is oracle dropping database oracle XE ?

I'm trying to access the download for oracle XE on windows but it fails with 404 error. Is Oracle leveraging its possession of mysql or is it a temporarily error? ...

PL/SQL pre-compile and Code Quality checks in an automated build environment?

We build software using Hudson and Maven. We have C#, java and last, but not least PL/SQL sources (sprocs, packages, DDL, crud) For C# and Java we do unit tests and code analysis, but we don't really know the health of our PL/SQL sources before we actually publish them to the target database. Requirements There are a couple of things ...

Is there a combination of "LIKE" and "IN" in SQL?

Hi folks. In SQL I (sadly) often have to use "LIKE" conditions due to databases that violate nearly every rule of normalization. I can't change that right now. But that's irrelevant to the question. Further, I often use conditions like WHERE something in (1,1,2,3,5,8,13,21) for better readability and flexibility of my SQL statements. ...

Oracle Age calculation from Date of birth and Today

I want to calculate present Age from Date of Birth in my oracle function. for that i am using (Today-Dob)/30/12. But this is not accurate as some months will have 31 days. I want to get the correct date with maximum precision How ca i do that?? ...

Auditing for Oracle with EclipseLink JPA

I am using EclipseLink and i have to audit in oracle so I can audit using pure JDBC with the V$session and i can audit the application name in oracle in this way but here in EclipseLink JPA I cannot set the application name to be audited, the way in which I have been trying is by setting dynamically the session param I want using the Ses...