Just combine two function as follows.
Example:
SELECT SUBSTR('ABCD_EFG', 0, INSTR(TABLE_NAME, '_')-1) AS output
FROM dual
Result:
ABCD
27 Ağustos 2013 Salı
18 Ağustos 2013 Pazar
Oracle - Date Conversion Sample
For those who always needs :
SELECT TO_CHAR(TO_DATE('19981215','YYYYMMDD'),'YYYY' ) FROM DUAL --Result 1998
SELECT TO_CHAR(TO_DATE('19981215','YYYYMMDD'),'MM' ) FROM DUAL --Result 12
SELECT TO_CHAR(TO_DATE('19981215','YYYYMMDD'),'DD' ) FROM DUAL --Result 15
SELECT TO_CHAR(TO_DATE('19981215','YYYYMMDD'),'YYYY' ) FROM DUAL --Result 1998
SELECT TO_CHAR(TO_DATE('19981215','YYYYMMDD'),'MM' ) FROM DUAL --Result 12
SELECT TO_CHAR(TO_DATE('19981215','YYYYMMDD'),'DD' ) FROM DUAL --Result 15
Oracle - Trim Leading Zeros
*Assuming the data you are working on is CHARACTER :
TO_CHAR( TO_NUMBER( COLUMN_A ) )
TO_CHAR( TO_NUMBER( COLUMN_A ) )
16 Temmuz 2013 Salı
ODI Knowledge Module for UNION , UNION_ALL, INTERSECT
Hi all
In this entry , i will explain how to make UNION , UNION_ALL, INTERSECT style operations without making extra insertion or temp table creation.
*Case : What i want to do is to gather all employee information which currently holds in different tables.
( Tested enironment : Oracle 10g database , ODI 11g )
At first we will create a table which holds the SQLs for final statement.
CREATE TABLE REPORTING.INTERFACE_QUERY
(
INTERFACE_NAME VARCHAR2(2000 BYTE),
EXE_SCRIPT LONG
)
* This table contains two columns ,one interface name which holds the name of the interface and EXE_SCRIPT which holds the SQL created by ODI interface.
*What we gonna do is to extract source tables called EMPLOYEE_PRE , EMPLOYEE_VICE_PRE, EMPLOYEE_PRG and fill them into a table called EMPLOYEE_ALL
*Now creating interfaces which are their target tables are dummy ( yellow interfaces )
* In this interface we will add EMPLOYEES who are currently presidents and with the help of IKM knowledge module called IKM SQL Control Append-SubQuery
Link for Download
http://rapidshare.com/files/815556971/KM_IKM_SQL_Control_Append_SubQuery.xml
SQL statement which is created by the interface will be inserted into REPORTING.INTERFACE_QUERY table.Same operation will be done for vice president and programmer tables .
As a result we have following data in our reference table ( Interface_Query ) and we have 3 temp interface.
*Now what we have to do create a main interface which gathers all sql statements above and load data into our target table.
*I will prepare the allignment of the columns for my target table which has to be matched with my subquery columns.
Before:
After:
Then i created a new interface called Interface_main. Mapping looked like this
* I drag 3 temp interfaces as a source and in order to maintain integrity connecting them with dummy join ( department_name ) and adding my target table with mappings ( those mapping added as dummy too )
* now i am assigning the knowledge module called IKM SQL Control Append-Union-Minus-Intersect-Union All
Link for Download
http://rapidshare.com/files/1050531261/KM_IKM_SQL_Control_Append_Union_Intersect_Union_All.xml
*Parameters for this Knowledge Module look like this
*Basically knowledge module gathers SQL statements from REPORTING.INTERFACE_QUERY and depends on the parameter we choose, it makes UNION , UNION ALL or INTERSECT and creates a resultset which load into our target table. As a result following sql statement has been created and executed.
*
In this entry , i will explain how to make UNION , UNION_ALL, INTERSECT style operations without making extra insertion or temp table creation.
*Case : What i want to do is to gather all employee information which currently holds in different tables.
( Tested enironment : Oracle 10g database , ODI 11g )
At first we will create a table which holds the SQLs for final statement.
CREATE TABLE REPORTING.INTERFACE_QUERY
(
INTERFACE_NAME VARCHAR2(2000 BYTE),
EXE_SCRIPT LONG
)
* This table contains two columns ,one interface name which holds the name of the interface and EXE_SCRIPT which holds the SQL created by ODI interface.
*What we gonna do is to extract source tables called EMPLOYEE_PRE , EMPLOYEE_VICE_PRE, EMPLOYEE_PRG and fill them into a table called EMPLOYEE_ALL
*Now creating interfaces which are their target tables are dummy ( yellow interfaces )
* In this interface we will add EMPLOYEES who are currently presidents and with the help of IKM knowledge module called IKM SQL Control Append-SubQuery
Link for Download
http://rapidshare.com/files/815556971/KM_IKM_SQL_Control_Append_SubQuery.xml
SQL statement which is created by the interface will be inserted into REPORTING.INTERFACE_QUERY table.Same operation will be done for vice president and programmer tables .
As a result we have following data in our reference table ( Interface_Query ) and we have 3 temp interface.
*Now what we have to do create a main interface which gathers all sql statements above and load data into our target table.
*I will prepare the allignment of the columns for my target table which has to be matched with my subquery columns.
Before:
After:
Then i created a new interface called Interface_main. Mapping looked like this
* I drag 3 temp interfaces as a source and in order to maintain integrity connecting them with dummy join ( department_name ) and adding my target table with mappings ( those mapping added as dummy too )
* now i am assigning the knowledge module called IKM SQL Control Append-Union-Minus-Intersect-Union All
Link for Download
http://rapidshare.com/files/1050531261/KM_IKM_SQL_Control_Append_Union_Intersect_Union_All.xml
*Parameters for this Knowledge Module look like this
*Basically knowledge module gathers SQL statements from REPORTING.INTERFACE_QUERY and depends on the parameter we choose, it makes UNION , UNION ALL or INTERSECT and creates a resultset which load into our target table. As a result following sql statement has been created and executed.
*
30 Kasım 2011 Çarşamba
Runnin Agent on Unix
Hi again
This is my second post and i wanna talk about how to run the agent.sh in Unix ... to run an agent first you should define it logically in topology... u should define your agent in logical and physical architecture tabs and define the context ,after that like i explained in my first post , you should have an installed ODI on Unix ... go to oracledi/bin/ directory and write the following code echo "agent.sh -NAME=" at now ( i assume that you are connecting to unix machine on telnet , so u should write this code) , so your agent gonna be started, in topology go your physical_architecture tab and click on your agent. In opening screen go to definition tab , click on test ... if everything is okay , u will get "Agent Test Successful" message on your screen ....
NOTE:: For normal agent that is all you need to do , but if you wanna run your scheduler agent , you should change the parameter of your odiparams.sh file....
( I will explain that stuff later :) )
This is my second post and i wanna talk about how to run the agent.sh in Unix ... to run an agent first you should define it logically in topology... u should define your agent in logical and physical architecture tabs and define the context ,after that like i explained in my first post , you should have an installed ODI on Unix ... go to oracledi/bin/ directory and write the following code echo "agent.sh -NAME=
NOTE:: For normal agent that is all you need to do , but if you wanna run your scheduler agent , you should change the parameter of your odiparams.sh file....
( I will explain that stuff later :) )
Scheduler Agent on Unix
Hello again,
In my previous post i mentioned about how to create an odi agent on unix environment which is quite simple now.. lets say u have an agent ... but u wanna run scheduler agent now... Well first of all you should go to ur odiparam.sh file which inside of your folder.... in this file , u have to change the following path
ODI_SECU_DRIVER=driver name that suits with ur database that used as Work Rep.
ODI_SECU_URL=url of your work rep. database
ODI_SECU_USER=database user...
ODI_SECU_ENCODED_PASS=this is the encoded password of ur database user....
ODI_SECU_WORK_REP=name of your work rep.
ODI_USER=SUPERVISOR
ODI_ENCODED_PASS=LELKIELGLJMDLKMGHEHJDBGBGFDGGH
ODI_JAVA_HOME= u should write the exact path of any JDK that is already inside of your machine.... 5.1 or newer versions.
Here it is an example ::
ODI_SECU_DRIVER=oracle.jdbc.driver.OracleDriver
ODI_SECU_URL=jdbc:oracle:thin:@20.2.99.147:1521:DWXX
ODI_SECU_USER=mYusER
ODI_SECU_ENCODED_PASS=encoded_pass
ODI_SECU_WORK_REP=myREP
ODI_USER=SUPERVISOR
ODI_ENCODED_PASS=LELKIELGLJMDLKMGHEHJDBGBGFDGGH
ODI_JAVA_HOME=/product/10g/db/jdk
your ODI_SECU_ENCODED_PASS should be look like ODI_ENCODED_PASS... which is the encoded password of ODI for SUPERVISOR
In my previous post i mentioned about how to create an odi agent on unix environment which is quite simple now.. lets say u have an agent ... but u wanna run scheduler agent now... Well first of all you should go to ur odiparam.sh file which inside of your folder.... in this file , u have to change the following path
ODI_SECU_DRIVER=driver name that suits with ur database that used as Work Rep.
ODI_SECU_URL=url of your work rep. database
ODI_SECU_USER=database user...
ODI_SECU_ENCODED_PASS=this is the encoded password of ur database user....
ODI_SECU_WORK_REP=name of your work rep.
ODI_USER=SUPERVISOR
ODI_ENCODED_PASS=LELKIELGLJMDLKMGHEHJDBGBGFDGGH
ODI_JAVA_HOME= u should write the exact path of any JDK that is already inside of your machine.... 5.1 or newer versions.
Here it is an example ::
ODI_SECU_DRIVER=oracle.jdbc.driver.OracleDriver
ODI_SECU_URL=jdbc:oracle:thin:@20.2.99.147:1521:DWXX
ODI_SECU_USER=mYusER
ODI_SECU_ENCODED_PASS=encoded_pass
ODI_SECU_WORK_REP=myREP
ODI_USER=SUPERVISOR
ODI_ENCODED_PASS=LELKIELGLJMDLKMGHEHJDBGBGFDGGH
ODI_JAVA_HOME=/product/10g/db/jdk
your ODI_SECU_ENCODED_PASS should be look like ODI_ENCODED_PASS... which is the encoded password of ODI for SUPERVISOR
4 Ekim 2011 Salı
startscen.sh ODI Scenario Load
If you have more than one work repository in ODI , you should add workrepository parameter into your sh load script.Otherwise you can face with an error message like this:
com.sunopsis.core.SnpsInexistantObjectException: SnpScen.getScenarioByCodeAndVersion ; SnpScen does not exist
The reason to get this error , ODI (in default mode) checks the odi params file and get reporsitory information.If the scenario you suppose to run inside of another repository then It raises the error we specify above.
Here it is a sample for correct usage:
sh startscen.sh SCENARIO_NAME 001 -WORK_REPOSITORY=WORKREP2
com.sunopsis.core.SnpsInexistantObjectException: SnpScen.getScenarioByCodeAndVersion ; SnpScen does not exist
The reason to get this error , ODI (in default mode) checks the odi params file and get reporsitory information.If the scenario you suppose to run inside of another repository then It raises the error we specify above.
Here it is a sample for correct usage:
sh startscen.sh SCENARIO_NAME 001 -WORK_REPOSITORY=WORKREP2
Kaydol:
Kayıtlar (Atom)








