Posts

Showing posts with the label pl/sql

How to convert rows into comma separated values in SQL Oracle (4 ways to convert)

Image
I have this requirement many times while coding interfaces in oracle apps. Every time, I use different options.    Here, I tried to list out the four different ways of achieving the same. Let’s take the well-known SCOTT schema for our example. The requirement is to show the manager name along with sub-ordinate names in a comma separated list. So first, let us simply join the tables to see the records, OPTION 1: LISTAGG function ( Tested in Oracle 11g) SELECT     manager . ename manager ,           LISTAGG ( suboridinates . ename , ',' )   WITHIN   GROUP   (order   by suboridinates . ename )  suboridinates_list      FROM  emp suboridinates ,  emp manager     WHERE  manager . empno  =  suboridinates . mgr     GROUP   BY    manager . ename ORDER   BY  manager . ename ; ...

Converting Number to Word

Image
Problem: How to convert number to word? Example: You need to write po amount in a word format for a report.  98  >>> Ninety-eight Solution: You can use following package for this operation. SELECT ap_amount_utilities_pkg.ap_convert_number( 9815 )  AMOUNT  FROM dual; Probably, you want to take this query in your local language. If so, you must change your NLS_LANGUAGE first. ALTER   SESSION   SET   NLS_LANGUAGE   =   'TURKISH' ; Then, SELECT ap_amount_utilities_pkg.ap_convert_number( 9815 )  AMOUNT  FROM dual; Note: This package supports 12 digit  most  .

R12 Table Naming Convention

Here is a good explanation for table name conversiton in Oracle R12.   _ALL Table holds all the information about different operating units. Multi-Org environment. You can also set the client_info to specific operating unit to see the data specific to that operating unit only.   _TL Tables corresponding to another table with the same name minus the _TL. These tables provide multiple language support. For each item in the table without _TL there can be many rows in the _TL table, but all with different values in the LANGUAGE column.   _B These are the CORE BASE tables. They are very important and the data is stored in the table with all validations. It is supposed that these table will always contain the perfect format data. If anything happens to the BASE table data, then it is a data corruption issue.   _F These are date tracked tables, which occur in HR and Payroll. For these there are two date columns EFFECTIVE_START_DATE and EFFECTIVE_END_DATE whic...

PL/SQL Web Service

Image
Tez araştırmam için oracle veri tabanı ile entegre çalışabilecek bir web servis yazmam gerek. Araştırmalarım sonucunda en uygun web servis'in PL/SQL ile yazılabileceğini keşfettim. Şu an JDeveloper ile tanışma safhasındayım. Aramız şu anlık kötü ama umarım mutlu sonuca ulaşırım :) Aşağıda linklerini verdiğim dökümanlardan faydalanıyorum bu arada. Belki birinin işine yarar diye paylaşayım dedim.  http://st-curriculum.oracle.com/obe/jdev/obe1013jdev/10131/wsfromplsqlpackage/devwsfrom%20plsql.htm http://docs.oracle.com/cd/E18941_01/tutorials/jdtut_11r2_14/jdtut_11r2_14.html http://oraclesoa.wordpress.com/2009/07/10/jdeveloper-11g-creating-plsql-webservice-and-deploying-to-weblogic-server/