Archive for the ‘Oracle’ Category

Oracle SQL Developer 2.1

Posted 14 Oct 2009 — by Arun
Category Oracle

I installed Oracle SQL Developer 2.1 Early Adapter release and it seems to load faster than the current stable version (1.5.x). SQL Developer, for it’s feature set or lack of that, takes more time to load in my system than Toad, but version 2.1 seems to be much better. You can download SQL Developer 2.1 from here.

Some of the new features in 2.1 includes:

  • Oracle SQL Developer Unit Testing provides a unit testing framework that allows you to build a set of sequential steps to create test cases for testing your PL/SQL code. You can build a collection of tests to make up a suite of tests that can be run and rerun to verify changes in your PL/SQL code and to still complete the required functionality.
  • Oracle SQL Developer Data Modeler is a stand alone product that supports logical, relational and conceptual modeling. The tool supports forward and reverse engineering and import and export from various sources. The Data Modeler supports an additional standalone model viewer, which allows users to open models built in the full Data Modeler. SQL Developer 2.1 incorporates the modeler viewer as an extension. integrated into SQL Developer. The Data Modeler Viewer also supports visualizing tables, views and object types on read-only Data Modeler diagrams. The SQL Developer Data Modeler Viewer extension is a free extension to SQL Developer.
  • The SQL Worksheet has been redesigned for SQL Developer 2.1 to support concurrent task processing for long running operations. Updates to the worksheet include the support of multiple data grids off the F9 (Run Statement) command and dockable OWA, DBMSOutput and SQL History windows.
  • For more features, click here.

Technorati Tags: , ,

Running Oracle E-Business suite in Ubuntu Linux

Posted 01 Oct 2009 — by Arun
Category Linux, Oracle, Ubuntu

When we were using Oracle Jinitiator to access Oracle E-Business suite application, I couldn’t get it to work in Linux. I tried several suggestions, but nothing worked. We finally moved to Sun Java JRE from Jinitiator. That helped a lot in getting it to work. I was getting this error message when we were using Jinitiator. I still see the message with Java, but it works.

In order to access this application, you must install the J2SE Plugin version 1.6.0_XX on your client and NPX_PLUGIN_PATH environment variable is set before starting Netscape. To install this plugin, click here to download the oaj2se.exe executable. Once the download is complete, double-click the oaj2se.exe file to install the plugin. You will be prompted to restart your browser when the installation is complete.

To get Java to work, use Synaptic package manager or whatever manager you use for installing programs in Linux. Search for sun java 6 and select sun-java6-jre (or whatever the latest version) and also select sun-java6-plugin. Install them. Once installed, Open a terminal from Application – Accessories – Terminal, type
cd /usr/lib/mozilla/plugin
directory (if you are using a different version of Firefox than the default one, then the directory name might be different) and press enter. Then type
sudo ln -s /usr/lib/jvm/java-6-sun-1.6.0.XX/jre/plugin/i386/ns7/libjavaplugin_oji.so .
and press enter (don’t forget the period at the end) where XX is the current Java version. At the time of this post, I think Java 1.6.0.16 is the latest, but Ubuntu might have an older version.
Restart Firefox and try starting the Oracle E-Business suite application. It worked for me.

Technorati Tags: , , , ,

Oracle SQL Developer pain

Posted 03 Jun 2009 — by Arun
Category Oracle

I like Oracle SQL Developer even though it’s slightly bulkier and slower to start than Toad (with less functionality and buggy). I found one annoying problem with SQL Developer. If you are running a query in the SQL Worksheet and the query is taking sometime to return the rows, you can’t open another worksheet until the query is done. If you try to open another worksheet, you’ll get a message saying “Connection currently busy. Try again or Abort”. What’s the purpose of multiple worksheets if you can’t work on more than one simaltaneously? I hope they fix this soon.

sqldevpain

Technorati Tags: , , ,

Oracle SQL Developer – Backspace, CTRL, Delete keys not working

Posted 20 May 2009 — by Arun
Category Oracle

I use SQL Developers for my development work. All of a sudden, the Backspace key, CTRL key, Delete key and other function keys stopped working in the SQL worksheet. I don’t remember doing anything out of ordinary, but those keys stopped working. I then Googled and found a solution. All you have to do is click on Tools menu – select Preferences, click on Accelerators on the left side, click on Load Preset button on the right, select Default (screenshot below), click OK and click OK again to close the preference window. All keys should work fine now.

sqldevpref

Technorati Tags: , , ,

Oracle SQL to get fiscal year dates

Posted 16 Apr 2009 — by Arun
Category Oracle

I wanted to find out the fiscal year, fiscal year start date and fiscal year end date for a given date. Our fiscal year runs from July 01st to June 30th. We’re on fiscal year 09 now starting from 01st July 2008 to 30th June 2009. It’ll be fiscal year 10 starting from 01st July 2009. One of my program requirement is to get the fiscal year, the start date and the end date. Here is the SQL I came up with (Thanks to eric6930 for the idea).

with FY as (
select decode(  trunc((substr(yearmonth, 5,2)-1)/6),
          1, substr(yearmonth, 1,4)+1,
         substr(yearmonth, 1,4) ) fiscal_year
     from (select to_char(trunc(to_date(‘16-APR-2009′,’DD-MON-YYYY’)),’YYYYMM’) yearmonth
     from dual))
select fiscal_year    
     , to_date((‘01-JUL-’)||(fiscal_year – 1)) fystart_date
     , to_date((‘30-JUN-’)||fiscal_year) fyend_date
     from FY

The SQL “select to_char(trunc(to_date(‘16-APR-2009′,’DD-MON-YYYY’)),’YYYYMM’) yearmonth from dual” converts a given date to year (YYYY) and month (MM) part, so 16-APR-2009 would be 200904.

substr(yearmonth, 5,2) will get the month part. I’m using “-1″ to keep the truncated value under 2, so it could be handled in the decode statement.

Since the fiscal year ends in June, I’m using 6 as the divisor. The trunc statement will return 1 for months from July and above. It’ll return a 0 for months from January to June. When it’s one, the decode statement will return the fiscal year as year + 1 from the date. When it’s zero, the decode statement will return the year as it.

Technorati Tags: , , ,

Ora_Tweet – Tweet from Oracle database using PLSQL

Posted 10 Apr 2009 — by Arun
Category Oracle

Ora_tweet is a PL/SQL Twitter API that can be used to send messages from your Oracle database to your twitter account. It might come handy for DBAs who twitters a lot. This is the first version and all it does right now is allow you to send a status update. Future changes might include more functionality. For more information, refer to Database Geek blog.

Technorati Tags: , , ,

Firefox 3.0 finally certified with Oracle E-Business suite

Posted 02 Mar 2009 — by Arun
Category Oracle, Technology

More than 8 months after Firefox 3.0 was released and Firefox 3.1 getting close to final release, Oracle has certified Firefox 3.0 with Oracle E-Business suite 11i and 12. They have released a new ATG interoperability patch to support Firefox 3.0. They have also released a patch for Java which removes static versioning and switches Firefox to non-static versioning. A long due changes finally arrived.

Source: Oracle E-Business Suite Technology blog.

Technorati Tags: , , ,

Oracle SQL – Converting multiple rows into single row

Posted 23 Feb 2009 — by Arun
Category Oracle, Technology

One of the project I’m working on has a requirement where if an employee has multiple assignments (multiple rows in the assignment table), then the SQL should consolidate his assignments into one row, with each column holding multiple values (for each row) with a delimiter.

For eg: Here is a sample table

SQL> desc test_asg
Assignment_id number(15)
Title varchar2(50)  — Job title
Emp_cat varchar2(2)  — Employment category

Here is the data in the table:

ASSIGNMENT_ID    TITLE         EMP_CAT
100              Comp info     AP
100              Technician    AP
101              Faculty       AP
102              Teaching      CS
102              Grad Assist   CS
102              Secretary     AP
103              Director      AP

The output requirement is

ASSIGNMENT_ID    JOB_TITLE                         EMP_CATEGORY
100              Comp info;Technician              AP;AP
101              Faculty                           AP
102              Teaching;Grad Assist;Secretary    CS;CS;AP
103              Director                          AP

Here is the SQL I wrote to get the output.

select assignment_id, substr(asg_title,2) JOB_TITLE, substr(asg_empcat,2) EMP_CATEGORY
from (
select assignment_id, max(sys_connect_by_path(title,’;')) asg_title, max(sys_connect_by_path(emp_cat,’;')) asg_empcat
from (
select assignment_id, title, emp_cat, row_number() over (partition by assignment_id order by assignment_id) rnum
from test_asg
)
start with rnum = 1
connect by prior rnum = rnum-1 and prior assignment_id = assignment_id
group by assignment_id
order by assignment_id
)
order by assignment_id;

The SYS_CONNECT_BY_PATH function returns the list of titles concatenated together and list of emp_cat connected together for each assignment id. The Start with .. Connect by clause is used to select data having hierarchical relationship.

Technorati Tags: , , , , ,

Offending Oracle’s E-Business Suite Report

Posted 10 Dec 2008 — by Arun
Category General, Oracle

Our HR department ran one of Oracle’s E-Business Suite report which reports on new hires. This is what we found in the log file of the report.

MSG-00001: tmp011:
MSG-00088: Hell with this
MSG-00001: hello
MSG-00088: Hell with this
MSG-00001: hello
MSG-00088: Hell with this
MSG-00001: hello
MSG-00088: Hell with this
MSG-00001: hello

………………

Though it looks funny, it is kind of offending to see such statements in a professional report. The obvious guess is, one of the developer might got frustrated with the program (or the employer) and put those messages in, but Oracle QA team should have removed those messages before releasing the report to enterprises. I’m not sure if Oracle said “Hell with this developer” and kicked him/her out.

SQL Developer 1.5 connection setting lost

Posted 12 May 2008 — by Arun
Category General, Oracle

If you work with Oracle Database, then you might have heard about SQL Developer. SQL Developer is a free graphical tool for database development. I use this for some of my Oracle work. It’s a decent tool and it’s free.

When I upgraded my SQL Developer to the latest version (1.5.0.53), I lost my database connection settings. The settings worked the first time I created them in the new version, but it was lost the next time I opened the SQL Developer. When I tried to recreate, the save or connect key did not work. I finally fixed it as per the advise given in the OTN forum. All you have to do is edit the sqldeveloper.conf file located under C:\Program Files\sql developer installation folder\sqldeveloper\bin using notepad or wordpad and add the following lines to the end of the file. Save and restart SQL Developer. You should see your connection settings back.

AddJavaLibFile ../../lib/java/api/jaxb-api.jar
AddJavaLibFile ../../lib/java/api/jsr173_api.jar
AddJavaLibFile ../../j2ee/home/lib/activation.jar
AddJavaLibFile ../../lib/java/shared/sun.jaxb/2.0/jaxb-xjc.jar
AddJavaLibFile ../../lib/java/shared/sun.jaxb/2.0/jaxb-impl.jar
AddJavaLibFile ../../lib/java/shared/sun.jaxb/2.0/jaxb1-impl.jar

Oracle SQL Developer