T-SQL functions in ORACLE
Use T-SQL functions in ORACLE too, so you can write one script version that works in SYBASE, SQLSERVER and ORACLE when need to use the following functions:
ceiling, charindex, dateadd, datediff, datename, datepart, day, db_id, db_name, getdate, host_id, host_name, left, len, month, replicate, right, space, str, str_replace, stuff, substring, suser_id, suser_name, user_id, user_name and year.
The file [comp_tsql_ORA_schema.txt|http://forums.databasejournal.com/attachment.php?attachmentid=564&d=1258547015] creates the tablespace and schema to put the objects, and the file [comp_tsql_ORA.txt|http://forums.databasejournal.com/attachment.php?attachmentid=569&d=1259256898] creates the functions into the new schema. They will be avaliable for any schema of the oracle instance.
Hope this help!
Any suggestion please contact.
aklein2003
Edited by: user1958693 on 26/11/2009 10:16
jgarry wrote:
J2EE beta released around 1999. Religious programming wars far preceded that. Here's but [one example|http://groups.google.com/group/comp.lang.lisp/browse_thread/thread/1c50bc13e9302f00/34bb8f3ac77e2388?q=programming+language+religion#34bb8f3ac77e2388] from a quick google. I'm no longer convinced that elegance is a desirable trait for a language. So call me a heretic.
Ever tried XLISP? :-)
It's different. Back then it was simply the language itself. And it was not really a religious kind of battle, but more a mine-is-bigger-and-better-than-yours one.
With Java, it is all about The Acrhitecture and the blessed language of Java. ;-)
I wouldn't so much blame J2EE believers for that. I think there is a fundamental complexity to web type paradigms that hasn't been described in a precise and encompassing enough manner to enable correct project planning.The basic problem is that the database is treated as a persistent storage layer only. A bit bucket. And that is exactly what a database is not.
But as it is used that, loads of database features now need to be duplicated in the application layer. Which is done. Very poorly.
Heck, I've even been told that J2EE's 3-tier architecture is not client server. Such ignorance is really unbelievable. Or is it pure stupidity?Until you just made me look it up, I would have thought that too, I'm sure I saw client/server defined as two-tier in the last century. But I have much more stupid misdefinitions to deal with on a daily basis, simply from the multiplicity of paradigms. I tend to retreat into my shell. Hehehe. Know that feeling... These days I rather run away, or set shields to full power, than try to get in yet another frustrating, fruitless and futile discussion with a Java head about the wonders of the J2EE architecture. Or trying to explain that this "new" architecture is predated with what we used in the 80's on mainframe systems with transaction monitors, block devices (the 80's web browsers) and databases - which software layer for software layer was almost identical to "+The Great Architecture+" of today. (and we did it without buzzwords too) ;-)
Client-server is a software architecture and in essence describes 3 basic software components. The User Interface (UI), the Application (APP) and the Database (DB). And there are various ways to put these components together in a client-server architecture. The mistake that the Java fanbois make is thinking that client-server means having the client as the UI and APP as a single component (so-called fat client) and then the DB component as the server.
There are numerous versions of these - including the APP component being a server component (as we now these days more commonly used in over the web).
My beef with the J2EE "+religion+" always has been that client-server is client-server. The fundamentals stay the same.
Similar Messages
-
Calling a pl/sql function from oracle forms
I have written a pl/sql function in a package.
package name- sup
function name - func
I have written a when-button-pressed trigger .from here I want to call this function.
How can I do that?
Please help..Thanks a lot..
User may select 20-30 check boxes for respective name & id...then at the end , user will hit OK...from here when-button-click will call a procedure....that will update/insert/delete a table data.The procedure I have written is:-
DECLARE
N_CNT Number(1);
D_SYSDATE Constant date :=sysdate;
Begin
select count(1)
into N_CNT
from dbtable L
where L.land_id = :BLK1.LAND_ID and
L.Operatoer_id = :BLK1.Operatoer_id and
L.suppl_id = :BLK1.suppl_id and
L.suppl_prof_id = :BLK1.suppl_prof_id;
if ((N_CNT = 0) and (:LANDLISTE.state = 'A')) then
insert into dbtable
LAND_ID,
STATE,
suppl_prof_id,
suppl_id,
OPERATOER_ID,
SIDST_OPD_DATO,
SIDST_OPD_INIT
values
:BLK1.LAND_ID,
'Y',
:BLK1.suppl_prof_id,
:BLK1.suppl_id,
:BLK1.Operatoer_id,
D_SYSDATE,
:BLK1.SIDST_OPD_INIT
elseif
((N_CNT>0 )and (:LANDLISTE.state = 'A')) then
update dbtable L
set L.SIDST_OPD_DATO = D_SYSDATE,
L.SIDST_OPD_INIT = :BLK1.SIDST_OPD_INIT
where L.land_id = :BLK1.LAND_ID and
L.Operatoer_id = :BLK1.Operatoer_id and
L.suppl_id = :BLK1.suppl_id and
L.suppl_prof_id = :BLK1.suppl_prof_id;
elseif ((N_CNT>0 ) and (:LANDLISTE.state = 'D')) then
delete from dbtable L
where L.land_id = :BLK1.LAND_ID and
L.Operatoer_id = :BLK1.Operatoer_id and
L.suppl_id = :BLK1.suppl_id and
L.suppl_prof_id = :BLK1.suppl_prof_id;
end if;
end;
Will it be able to load multiple data(20-30 at a time) to the table?
Should I write anything to commit the data in the table?
I am very new to oracle forms...please help.. -
How I work with MS-SQL function in oracle
I’m working in oracle now but I don’t know how can I use following function in oracle.
convert, dateadd, datediff, fetch_status, isnumeric, reverse, str and stuffAlso available in 10g, the model clause version, taken from this How to display text in reverse order ?.
WITH t AS (SELECT 'abcdefg' col1
FROM DUAL
UNION
SELECT ''
FROM DUAL )
SELECT col1
, new_col1
FROM t
MODEL
PARTITION BY (ROWNUM rn)
DIMENSION BY (0 dim)
MEASURES (col1, CAST ('' AS VARCHAR2(255)) new_col1)
RULES ITERATE(99) UNTIL (LENGTH(new_col1[0]) = LENGTH(col1[0]))
(new_col1[0] = SUBSTR(col1[0], ITERATION_NUMBER + 1, 1) || new_col1[0])
COL1 NEW_COL1
abcdefg gfedcbaC. -
Access SQL Function in Oracle?
Microsoft Access SQL has a function called LastOf which extracts
data from a column within the last row returned when multiple
rows are returned. This function works even when many tables are
joined and only one of them returns multiple rows. Does Oracle's
SQL implementation have anything like it?I can't find a reference to a LastOf function for MS-Access.
Perhaps you are refering to the Last(expr) function or MoveLast
method of DAO Recordset.
Last behavior can be reached in one of several ways depending on
the desired results, most depending on the ordering of the result
set. Both Access and VB use the concept of a recordset, which is
analogous to a CURSOR in Oracle.
To use an implicit cursor, and only retreive the one row, you
might use the sudo-colomn ROWNUM:
SELECT my_col FROM my_tab WHERE ROWNUM = 1
This would give you the first record of the result set, but there
is no guarantee on which row it would be - so you might consider
ordering the result set:
SELECT my_col FROM my_tab WHERE ROWNUM = 1 ORDER BY my_col ASC;
Which would return one row, the value of my_col being the
smallest value in the table. Now might be a good time to talk
aggrogate functions, such as:
SELECT MIN( my_col ) FROM my_tab;
which does the same thing as above.
If all else fails, RTFM.
-Kevin -
Availability of stdnormal_inv PL/SQL function in Oracle Database
I am in need of stdnormal_inv statistical function to calculate the Quantile of Standard Normal Distribution for safety stock computation in MRP module.
If anyone knows whether any pl/sql code exists to compute stdnormal_inv, please help me with the information. We are using Oracle 7.3.3 database.
Many Thanks,
Ravi.You can use the UTL_FILE package.
In order to access directories on your database server you must
enable the access in the INIT.ORA file with one or more utl_file_dir entries.
HTH, Robert -
Pl/sql function body returning SQL query - Print function
Hello all,
I have pl/sql function body returning SQL query for my reports for my new project that I am developing. We dont have any BI tool or anything for APEX so we use Oracle reports to get the same reports to be printed in PDF format. I had been using SQL function for Reports all these days and grabbing the data using SQL query was easy in Oracle reports. But this time we had atleast 8 fields in search criteria and hence I thouhgt PL/sql function body returning SQL query could be something easy to handle that scenario. We have 11 such reports in our project. Now when we tried to use the same PL/sql function to oracle reports , I was told by one of our Oracle reports expert, that we have to write it into functions and use it in SQL query to get the Reports in Oracle reports. Is there any Easy way to convert the same Pl/SQL function or get a PDF format of the same report in APEX without going thru the much pains of rewriting the whole SQL Query.
thank you
DevisriHi,
give this a go.
I can't test it as I don't have the tables in my schema.
create or replace package MK_TEST_PF is
-- Author : MK
-- Created : 21/06/2010 16:30:19
-- Purpose : FOR LUCY_DISCOVER
-- Public type declarations
/* -- just guess the table row types.....
-- otherwise it won't compile
type test_rec is record
(INV REP.inv%type
,cNUMBER REP.cNUMBER%type
,OPENDATE REP.OPENDATE%type
,TARGETDATE REP.ESTCOMPLETE%type
,DATECLOSED REP.COMPLETED%type
,STATUS REP.STATUS%type
,cCODE REP.cCODE%type
,line varchar2(4000)
,SIGc varchar2(4000)
,CLASS REP.CLASS%type
,SUMM REP.SUMM%type
,AREA REP.AREA%type
type test_rec is record
(INV varchar2(4000)
,cNUMBER varchar2(4000)
,OPENDATE varchar2(4000)
,TARGETDATE varchar2(4000)
,DATECLOSED varchar2(4000)
,STATUS varchar2(4000)
,cCODE varchar2(4000)
,line varchar2(4000)
,SIGc varchar2(4000)
,CLASS varchar2(4000)
,SUMM varchar2(4000)
,AREA varchar2(4000)
type test_tab is table of test_rec;
-- Public constant declarations
-- Public variable declarations
-- Public function and procedure declarations
end MK_TEST_PF;
create or replace package body MK_TEST_PF is
-- Private type declarations
-- Private constant declarations
-- Private variable declarations
-- Function and procedure implementations
function get_query_f
(p_inv VARCHAR2 := UPPER(v('P44_INV'))
,p_reg VARCHAR2 := UPPER(v('P44_CLASS'))
,p_proarea VARCHAR2 := UPPER(v('P44_PROGRAM_AREA'))
,p_disp VARCHAR2 := UPPER(v('P44_DISPOSITION'))
,p_coding VARCHAR2 := UPPER(v('P44_CODING'))
,p_status VARCHAR2 := UPPER(v('P44_STATUS'))
,p_SIG VARCHAR2 := UPPER(v('P44_SIG_c'))
,p_inc_sum VARCHAR2 := UPPER(v('P44_INCLUDE_SUMM_FIELD'))
,p_word VARCHAR2 := UPPER(v('P44_WORD_IN_SUMM'))
,p_timeframe VARCHAR2 := UPPER(v('P44_TIME_FRAME'))
,p_rec VARCHAR2 := UPPER(v('P44_RECORD_KEEPING'))
,p_WORD_IN_SUMM VARCHAR2 := UPPER(v('P44_WORD_IN_SUMM'))
,p_ON_AFTER VARCHAR2 := UPPER(v('P44_ON_AFTER'))
,p_ON_BEFORE VARCHAR2 := UPPER(v('P44_ON_BEFORE'))
return varchar2
is
v_sql VARCHAR2(5000);
-- v_inv VARCHAR2(100);
-- v_reg VARCHAR2(100);
-- v_proarea VARCHAR2(100);
-- v_status VARCHAR2(100);
-- v_SIG VARCHAR2(100);
-- v_disp VARCHAR2(100);
-- v_coding VARCHAR2(100);
-- v_inc_sum VARCHAR2(4);
-- v_word VARCHAR2(4000);
v_wildcard VARCHAR2(2000);
-- v_timeframe VARCHAR2(100);
-- v_rec VARCHAR2(5);
v_record VARCHAR2(5);
v_open VARCHAR2(100);
v_closed VARCHAR2(100);
v_PEND VARCHAR2(100);
v_refSIG VARCHAR2(100);
v_refreg VARCHAR2(100);
v_refother VARCHAR2(100);
v_y varchar2(100);
BEGIN
--v_inv := UPPER(v('P44_INV')) ;
v_record := 'R%';
v_wildcard := '%';
v_open := 'OPEN';
v_closed := 'CLOSED';
v_PEND := 'PEND';
v_refSIG := 'REF - SIG';
v_refreg := 'REF - CLASS';
v_refother := 'REF - OTHER';
v_y := 'Y';
v_sql := 'SELECT REP.INV as INV, REP.cNUMBER as cNUMBER, REP.OPENDATE as OPENDATE,
REP.ESTCOMPLETE as TARGETDATE, REP.COMPLETED as DATECLOSED, REP.STATUS as STATUS,
REP.cCODE as cCODE, apex_item.checkbox(1,REP.line,null,'''||v_y||''') line , apex_item.checkbox(1,REP.SIG,null,'''||v_y||''') SIGc ,
REP.CLASS as CLASS, REP.SUMM as SUMM, REP.AREA as AREA from REP where 1=1';
IF p_rec is not null then
IF p_rec = 'E' then
v_sql := v_sql|| ' and upper(REP.cnumber) not like '''||v_record||'''';
ELSIF p_rec = 'D' then
v_sql := v_sql|| ' and upper(REP.cnumber) like '''||v_record||'''';
ELSIF p_rec = 'I' then
v_sql := v_sql|| ' and REP.cnumber = REP.cnumber ';
end if ;
end if ;
IF upper(p_status) not like '%NULL%' then
IF upper(p_status) like '%OPEN%' then
v_sql := v_sql||' AND upper(REP.status) like '''||v_open||'''';
ELSIF upper(p_status) like '%CLOSED%' then
v_sql := v_sql||' AND upper(REP.status) like '''||v_closed||'''';
ELSIF upper(v_PEND) like '%PEND%' then
v_sql := v_sql||' AND upper(REP.status) like '''||v_PEND||'''';
ELSIF upper(v_refSIG) like '%REF - SIG%' then
v_sql := v_sql||' AND upper(REP.status) like '''||v_refSIG||'''';
ELSIF upper(v_refreg) like '%REF - CLASS%' then
v_sql := v_sql||' AND upper(REP.status) like '''||v_refreg||'''';
ELSIF upper(v_refother) like '%REF - OTHER%' then
v_sql := v_sql||' AND upper(REP.status) like '''||v_refother||'''';
END IF ;
END IF ;
IF p_inv = 'NULL' THEN
v_sql := v_sql||' AND instr(upper(REP.INV),'''||p_inv||''') > 0';
END IF ;
IF p_reg = 'NULL' THEN
v_sql := v_sql||' AND instr(upper(REP.CLASS),'''||p_reg||''') > 0';
END IF ;
IF p_proarea = 'NULL' THEN
v_sql := v_sql||' AND instr(upper(REP.AREA),'''||p_proarea||''') > 0';
END IF ;
IF p_disp = 'NULL' THEN
v_sql := v_sql||' AND instr(upper(REP.disposition),'''||p_disp||''') > 0';
END IF ;
IF p_coding = 'NULL' THEN
v_sql := v_sql||' AND instr(upper(REP.ccode),'''||p_coding||''') > 0';
END IF ;
IF p_SIG = ' ' THEN
v_sql := v_sql||' AND instr(upper(REP.SIG),'''||p_SIG||''') > 0';
END IF ;
IF p_word is not null then
v_sql := v_sql|| ' and
instr(upper(REP.SUMM),
upper(nvl('''||p_WORD_IN_SUMM||''',REP.SUMM))) > 0';
end if ;
If p_timeframe is not null then
if upper(p_timeframe) = 'OPEN' then
v_sql := v_sql|| ' and to_date(REP.opendate) between to_date ('''||p_ON_AFTER||''') and to_date('''||p_ON_BEFORE||''')';
elsif upper(p_timeframe) = 'CLOSED' then
v_sql := v_sql|| ' and to_date(REP.completed) between to_date ('''||p_ON_AFTER||''') and to_date('''||p_ON_BEFORE||''')';
elsif upper(p_timeframe) = 'EST' then
v_sql := v_sql|| ' and to_date(REP.estcomplete) between to_date ('''||p_ON_AFTER||''') and to_date('''||p_ON_BEFORE||''')';
end if;
end if;
v_sql := v_sql ||' order by REP.INV ';
return v_sql;
end get_query_f;
function test_pf
(p_inv VARCHAR2 := UPPER(v('P44_INV'))
,p_reg VARCHAR2 := UPPER(v('P44_CLASS'))
,p_proarea VARCHAR2 := UPPER(v('P44_PROGRAM_AREA'))
,p_disp VARCHAR2 := UPPER(v('P44_DISPOSITION'))
,p_coding VARCHAR2 := UPPER(v('P44_CODING'))
,p_status VARCHAR2 := UPPER(v('P44_STATUS'))
,p_SIG VARCHAR2 := UPPER(v('P44_SIG_c'))
,p_inc_sum VARCHAR2 := UPPER(v('P44_INCLUDE_SUMM_FIELD'))
,p_word VARCHAR2 := UPPER(v('P44_WORD_IN_SUMM'))
,p_timeframe VARCHAR2 := UPPER(v('P44_TIME_FRAME'))
,p_rec VARCHAR2 := UPPER(v('P44_RECORD_KEEPING'))
,p_WORD_IN_SUMM VARCHAR2 := UPPER(v('P44_WORD_IN_SUMM'))
,p_ON_AFTER VARCHAR2 := UPPER(v('P44_ON_AFTER'))
,p_ON_BEFORE VARCHAR2 := UPPER(v('P44_ON_BEFORE'))
RETURN test_tab PIPELINED
is
type test_c is ref cursor;
v_row test_tab;
v_sql varchar2(4000);
v_cursor test_c;
begin
v_sql := get_query_f
(p_inv
,p_reg
,p_proarea
,p_disp
,p_coding
,p_status
,p_SIG
,p_inc_sum
,p_word
,p_timeframe
,p_rec
,p_WORD_IN_SUMM
,p_ON_AFTER
,p_ON_BEFORE
open v_cursor for v_sql;
fetch v_cursor bulk collect into v_row;
close v_cursor;
for i in 1 .. v_row.count loop
pipe row (v_row(i));
end loop;
return;
end test_pf;
end MK_TEST_PF;
/Regards
Michael -
What are the built-in SQL functions in Oracle? I already know: COUNT, SUM, AVG, MAX, and MIN. Are there any more?
Thanxhttp://download-west.oracle.com/docs/cd/B10501_01/server.920/a96540/functions2a.htm
-
Using sql functions (min, max, avg) on varray or table collection
Hi,
I would like to know if there is a way to use sql function or oracle sql function like Min,Max, Avg or percentile_cont on varray or table collection ?
Does anyone encountered this type of problem ?
ThanksYes you can apply Min,Max, Avg... if varray or table collection type is SQL (created in the databaase) UDF, not PL/SQL declared type:
SQL> set serveroutput on
SQL> declare
2 type str_tbl_type is table of varchar2(4000);
3 str_tbl str_tbl_type := str_tbl_type('X','A','D','ZZZ');
4 max_val varchar2(4000);
5 begin
6 select max(column_value)
7 into max_val
8 from table(str_tbl);
9 dbms_output.put_line('Max value is "' || max_val || '"');
10 end;
11 /
from table(str_tbl);
ERROR at line 8:
ORA-06550: line 8, column 18:
PLS-00642: local collection types not allowed in SQL statements
ORA-06550: line 8, column 12:
PL/SQL: ORA-22905: cannot access rows from a non-nested table item
ORA-06550: line 6, column 5:
PL/SQL: SQL Statement ignored
SQL> create or replace type str_tbl_type is table of varchar2(4000);
2 /
Type created.
SQL> declare
2 str_tbl str_tbl_type := str_tbl_type('X','A','D','ZZZ');
3 max_val varchar2(4000);
4 begin
5 select max(column_value)
6 into max_val
7 from table(str_tbl);
8 dbms_output.put_line('Max value is "' || max_val || '"');
9 end;
10 /
Max value is "ZZZ"
PL/SQL procedure successfully completed.
SQL> SY. -
CONVERT function in SQL Server to oracle
All,
How to convert CONVERT function in SQL Server to oracle, below mentioned format is in SQL Server:
variable1 = convert(numeric(20), SUBSTRING( parameter1,parameter2,parameter3)
parameter1 datatype nvarchar2(100)
parameter2 datatype bigint
parameter3 datatype bigint
I did bit R&D, but was not successful..but still getting on..
If any help that would be great...
Regards,
~ORAYou cannot specify the precision/scale or length of input paramters to a stored procedure in Oracle, or at least the pl/sql engine does not respect the sizing. Assuming that you want to do something with variable1 in the procedure, and not just return it, the Oracle equivalent would be something along the lines of:
SQL> CREATE FUNCTION f (p_param1 IN VARCHAR2,
2 p_param2 IN NUMBER,
3 p_param3 IN NUMBER) RETURN NUMBER IS
4 l_var1 NUMBER(20) := SUBSTR(p_param1, p_param2, p_param3);
5 BEGIN
6 RETURN l_var1 * 10;
7 END;
8 /
Function created.
SQL> SELECT f('ABC10DEF', 4, 2) FROM dual;
F('ABC10DEF',4,2)
100You may need to adjust the return type to match what you are actually returning.
You can also use this iin a direct assignment in pl/sql without doig a select, something like:
SQL> DECLARE
2 l_num NUMBER(20);
3 BEGIN
4 l_num := f('ABC10DEF', 4, 2);
5 DBMS_OUTPUT.Put_Line('The number is: '||l_num);
6 END;
7 /
The number is: 100John -
Recursive functions in Oracle SQL.
OK,
Here is the pivot problem. Only this time were on an Oracle 11.1.0.7.0.
I've created a table called:
CREATE TABLE STAGING.MY_TAB_COLS
TABLE_NAME VARCHAR2(30 BYTE),
COLUMN_NAME VARCHAR2(30 BYTE)
)And I've put the following data into it:
Insert into STAGING.MY_TAB_COLS
(TABLE_NAME, COLUMN_NAME)
Values
('AAEADP1', 'SSN_SOURCE');
Insert into STAGING.MY_TAB_COLS
(TABLE_NAME, COLUMN_NAME)
Values
('AAEADP1', 'FIRST_NAME_SOURCE');
Insert into STAGING.MY_TAB_COLS
(TABLE_NAME, COLUMN_NAME)
Values
('AAEADP1', 'LAST_NAME_SOURCE');
Insert into STAGING.MY_TAB_COLS
(TABLE_NAME, COLUMN_NAME)
Values
('AAEADP1', 'DOB_SOURCE');
Insert into STAGING.MY_TAB_COLS
(TABLE_NAME, COLUMN_NAME)
Values
('AAEADP1', 'EMP_SSN_SOURCE');
Insert into STAGING.MY_TAB_COLS
(TABLE_NAME, COLUMN_NAME)
Values
('AAEADP1', 'EMP_FIRST_NAME_SOURCE');
Insert into STAGING.MY_TAB_COLS
(TABLE_NAME, COLUMN_NAME)
Values
('AAEADP1', 'EMP_LAST_NAME_SOURCE');
Insert into STAGING.MY_TAB_COLS
(TABLE_NAME, COLUMN_NAME)
Values
('AAEADP1', 'EMP_DOB_SOURCE');
Insert into STAGING.MY_TAB_COLS
(TABLE_NAME, COLUMN_NAME)
Values
('AAEADP1', 'MPI');
Insert into STAGING.MY_TAB_COLS
(TABLE_NAME, COLUMN_NAME)
Values
('AAEADP1', 'SSN_STANDARDIZED');
Insert into STAGING.MY_TAB_COLS
(TABLE_NAME, COLUMN_NAME)
Values
('AAEADP1', 'FIRST_NAME_A_STANDARDIZED');
Insert into STAGING.MY_TAB_COLS
(TABLE_NAME, COLUMN_NAME)
Values
('AAEADP1', 'FIRST_NAME_B_STANDARDIZED');
Insert into STAGING.MY_TAB_COLS
(TABLE_NAME, COLUMN_NAME)
Values
('AAEADP1', 'LAST_NAME_A_STANDARDIZED');
Insert into STAGING.MY_TAB_COLS
(TABLE_NAME, COLUMN_NAME)
Values
('AAEADP1', 'LAST_NAME_B_STANDARDIZED');
Insert into STAGING.MY_TAB_COLS
(TABLE_NAME, COLUMN_NAME)
Values
('AAEADP1', 'EMP_SSN_STANDARDIZED');
Insert into STAGING.MY_TAB_COLS
(TABLE_NAME, COLUMN_NAME)
Values
('AAEADP1', 'EMP_FIRST_NAME_A_STANDARDIZED');
Insert into STAGING.MY_TAB_COLS
(TABLE_NAME, COLUMN_NAME)
Values
('AAEADP1', 'EMP_FIRST_NAME_B_STANDARDIZED');
Insert into STAGING.MY_TAB_COLS
(TABLE_NAME, COLUMN_NAME)
Values
('AAEADP1', 'EMP_LAST_NAME_A_STANDARDIZED');
Insert into STAGING.MY_TAB_COLS
(TABLE_NAME, COLUMN_NAME)
Values
('AAEADP1', 'EMP_LAST_NAME_B_STANDARDIZED');
Insert into STAGING.MY_TAB_COLS
(TABLE_NAME, COLUMN_NAME)
Values
('AAMAET1', 'MPI_OLD');
Insert into STAGING.MY_TAB_COLS
(TABLE_NAME, COLUMN_NAME)
Values
('AAMAET1', 'EMPLOYEE_SSN_SOURCE');
Insert into STAGING.MY_TAB_COLS
(TABLE_NAME, COLUMN_NAME)
Values
('AAMAET1', 'EMPLOYEE_LAST_NAME_SOURCE');
Insert into STAGING.MY_TAB_COLS
(TABLE_NAME, COLUMN_NAME)
Values
('AAMAET1', 'EMPLOYEE_FIRST_NAME_SOURCE');
Insert into STAGING.MY_TAB_COLS
(TABLE_NAME, COLUMN_NAME)
Values
('AAMAET1', 'EMPLOYEE_DOB');
Insert into STAGING.MY_TAB_COLS
(TABLE_NAME, COLUMN_NAME)
Values
('AAMAET1', 'PATIENT_SSN');
Insert into STAGING.MY_TAB_COLS
(TABLE_NAME, COLUMN_NAME)
Values
('AAMAET1', 'PATIENT_LAST_NAME_SOURCE');
Insert into STAGING.MY_TAB_COLS
(TABLE_NAME, COLUMN_NAME)
Values
('AAMAET1', 'PATIENT_FIRST_NAME_SOURCE');
Insert into STAGING.MY_TAB_COLS
(TABLE_NAME, COLUMN_NAME)
Values
('AAMAET1', 'PATIENT_DOB');
Insert into STAGING.MY_TAB_COLS
(TABLE_NAME, COLUMN_NAME)
Values
('AAMAET1', 'EMPLOYEE_NON_SSN_ID');
Insert into STAGING.MY_TAB_COLS
(TABLE_NAME, COLUMN_NAME)
Values
('AAMAET1', 'EMPLOYEE_SSN_STANDARDIZED');
Insert into STAGING.MY_TAB_COLS
(TABLE_NAME, COLUMN_NAME)
Values
('AAMAET1', 'PATIENT_FIRST_NAME_A_STD');
Insert into STAGING.MY_TAB_COLS
(TABLE_NAME, COLUMN_NAME)
Values
('AAMAET1', 'PATIENT_FIRST_NAME_B_STD');
Insert into STAGING.MY_TAB_COLS
(TABLE_NAME, COLUMN_NAME)
Values
('AAMAET1', 'PATIENT_LAST_NAME_A_STD');
Insert into STAGING.MY_TAB_COLS
(TABLE_NAME, COLUMN_NAME)
Values
('AAMAET1', 'PATIENT_LAST_NAME_B_STD');
Insert into STAGING.MY_TAB_COLS
(TABLE_NAME, COLUMN_NAME)
Values
('AAMAET1', 'EMPLOYEE_FIRST_NAME_A_STD');
Insert into STAGING.MY_TAB_COLS
(TABLE_NAME, COLUMN_NAME)
Values
('AAMAET1', 'EMPLOYEE_FIRST_NAME_B_STD');
Insert into STAGING.MY_TAB_COLS
(TABLE_NAME, COLUMN_NAME)
Values
('AAMAET1', 'EMPLOYEE_LAST_NAME_A_STD');
Insert into STAGING.MY_TAB_COLS
(TABLE_NAME, COLUMN_NAME)
Values
('AAMAET1', 'EMPLOYEE_LAST_NAME_B_STD');
Insert into STAGING.MY_TAB_COLS
(TABLE_NAME, COLUMN_NAME)
Values
('AAMAET1', 'PATIENT_SSN_STANDARDIZED');
Insert into STAGING.MY_TAB_COLS
(TABLE_NAME, COLUMN_NAME)
Values
('AAMAET1', 'MPI');
Insert into STAGING.MY_TAB_COLS
(TABLE_NAME, COLUMN_NAME)
Values
('AAPMED1', 'EMPLOYEE_SSN');
Insert into STAGING.MY_TAB_COLS
(TABLE_NAME, COLUMN_NAME)
Values
('AAPMED1', 'EMPLOYEE_FIRST_NAME');
Insert into STAGING.MY_TAB_COLS
(TABLE_NAME, COLUMN_NAME)
Values
('AAPMED1', 'EMPLOYEE_LAST_NAME');
Insert into STAGING.MY_TAB_COLS
(TABLE_NAME, COLUMN_NAME)
Values
('AAPMED1', 'EMPLOYEE_DATE_OF_BIRTH');
Insert into STAGING.MY_TAB_COLS
(TABLE_NAME, COLUMN_NAME)
Values
('AAPMED1', 'PATIENT_SSN');
Insert into STAGING.MY_TAB_COLS
(TABLE_NAME, COLUMN_NAME)
Values
('AAPMED1', 'PATIENT_FIRST_NAME_SOURCE');
Insert into STAGING.MY_TAB_COLS
(TABLE_NAME, COLUMN_NAME)
Values
('AAPMED1', 'PATIENT_LAST_NAME_SOURCE');
Insert into STAGING.MY_TAB_COLS
(TABLE_NAME, COLUMN_NAME)
Values
('AAPMED1', 'PATIENT_DOB');
Insert into STAGING.MY_TAB_COLS
(TABLE_NAME, COLUMN_NAME)
Values
('AAPMED1', 'PRESCRIBER_LAST_NAME');
Insert into STAGING.MY_TAB_COLS
(TABLE_NAME, COLUMN_NAME)
Values
('AAPMED1', 'MPI');
Insert into STAGING.MY_TAB_COLS
(TABLE_NAME, COLUMN_NAME)
Values
('AAPMED1', 'PATIENT_FIRST_NAME_A_STD');
Insert into STAGING.MY_TAB_COLS
(TABLE_NAME, COLUMN_NAME)
Values
('AAPMED1', 'PATIENT_FIRST_NAME_B_STD');
Insert into STAGING.MY_TAB_COLS
(TABLE_NAME, COLUMN_NAME)
Values
('AAPMED1', 'PATIENT_LAST_NAME_A_STD');
Insert into STAGING.MY_TAB_COLS
(TABLE_NAME, COLUMN_NAME)
Values
('AAPMED1', 'PATIENT_LAST_NAME_B_STD');My task for this problem is pretty straight forward.
Using the ALL_TAB_COLS table I want to list out certain fields for each table name specified.
All the tables have fields that are similar. I just want these table names to go across the top.
And the field names to list out under each table.
So you would have something like:
AAEADP1 AAMAET1 AAPMED1
SSN_SOURCE MPI_OLD EMPLOYEE_SSN
FIRST_NAME_SOURCE EMPLOYEE_SSN_SOURCE EMPLOYEE_FIRST_NAME
LAST_NAME_SOURCE EMPLOYEE_LAST_NAME_SOURCE EMPLOYEE_LAST_NAME
DOB_SOURCE EMPLOYEE_FIRST_NAME_SOURCE EMPLOYEE_DATE_OF_BIRTH
EMP_SSN_SOURCE EMPLOYEE_DOB PATIENT_SSN
EMP_FIRST_NAME_SOURCE PATIENT_SSN PATIENT_FIRST_NAME_SOURCE
EMP_LAST_NAME_SOURCE PATIENT_LAST_NAME_SOURCE PATIENT_LAST_NAME_SOURCE
EMP_DOB_SOURCE PATIENT_FIRST_NAME_SOURCE PATIENT_DOB
MPI PATIENT_DOB PRESCRIBER_LAST_NAME
SSN_STANDARDIZED EMPLOYEE_NON_SSN_ID MPI
FIRST_NAME_A_STANDARDIZED EMPLOYEE_SSN_STANDARDIZED PATIENT_FIRST_NAME_A_STD
FIRST_NAME_B_STANDARDIZED PATIENT_FIRST_NAME_A_STD PATIENT_FIRST_NAME_B_STD
LAST_NAME_A_STANDARDIZED PATIENT_FIRST_NAME_B_STD PATIENT_LAST_NAME_A_STD
LAST_NAME_B_STANDARDIZED PATIENT_LAST_NAME_A_STD PATIENT_LAST_NAME_B_STD
EMP_SSN_STANDARDIZED PATIENT_LAST_NAME_B_STD
EMP_FIRST_NAME_A_STANDARDIZED EMPLOYEE_FIRST_NAME_A_STD
EMP_FIRST_NAME_B_STANDARDIZED EMPLOYEE_FIRST_NAME_B_STD
EMP_LAST_NAME_A_STANDARDIZED EMPLOYEE_LAST_NAME_A_STD
EMP_LAST_NAME_B_STANDARDIZED EMPLOYEE_LAST_NAME_B_STD
PATIENT_SSN_STANDARDIZED
MPI Where each table name lists across with all of their column names under each table.
The query that I have so far is The following:
SELECT T1.TABLE_NAME, T1.COLUMN_NAME
FROM my_tab_cols t1, ( SELECT DISTINCT UPPER (SOURCE_TABLE) TABLE_NAME
FROM MPI_DEMOGRAPHICS_TEST
ORDER BY UPPER (SOURCE_TABLE)) tn
WHERE T1.TABLE_NAME = tn.TABLE_NAME
AND ( T1.column_name LIKE '%MPI%'
OR T1.column_name LIKE '%SSN%'
OR T1.column_name LIKE '%E%SSN%'
OR T1.column_name LIKE '%R%SSN%'
OR T1.column_name LIKE '%P%SSN%'
OR T1.column_name LIKE '%BIRTH%'
OR T1.column_name LIKE '%DOB%'
OR T1.column_name LIKE '%FIRST%NAME%'
OR T1.column_name LIKE '%LAST%NAME%'
OR T1.column_name LIKE '%CLIENT%NAME%'
OR T1.column_name LIKE '%SOURCE_TABLE%'
OR T1.column_name LIKE '%TABLE%')
ORDER BY T1.TABLE_NAME, t1.column_id; It just list everything straight down.
Where the MPI_DEMOGRAPHIES_TEST table feeds the relevant table names to the ALL_TAB_COLS table.
It can just be substituted with a list of the values, AAEADP1, AAMAET1, AAPMED1.
Is there a 'pivot' function in Oracle 11.1 that I can use to list these column names out sideways as opposed to what I did before?
Thanks,Hi,
Here's one way to get results like that using the Oracle 11 SELECT ... PIVOT feature:
WITH got_nums AS
SELECT column_name
, ROW_NUMBER () OVER ( PARTITION BY table_name
ORDER BY column_name
) AS r_num
, DENSE_RANK () OVER ( ORDER BY table_name) AS c_num
FROM my_tab_cols
WHERE column_name LIKE '%MPI%'
OR column_name LIKE '%SSN%'
-- OR column_name LIKE '%E%SSN%' -- Included in '%SSN% above
-- OR column_name LIKE '%R%SSN%' -- Included in '%SSN% above
-- OR column_name LIKE '%P%SSN%' -- Included in '%SSN% above
OR column_name LIKE '%BIRTH%'
OR column_name LIKE '%DOB%'
OR column_name LIKE '%FIRST%NAME%'
OR column_name LIKE '%LAST%NAME%'
OR column_name LIKE '%CLIENT%NAME%'
-- OR column_name LIKE '%SOURCE_TABLE%' -- Included in %TABLE% below
OR column_name LIKE '%TABLE%'
UNION
SELECT table_name AS colum_name
, 0 AS r_num
, DENSE_RANK () OVER ( ORDER BY table_name) AS c_num
FROM my_tab_cols
SELECT *
FROM got_nums
PIVOT ( MIN (column_name)
FOR c_num IN ( 1 AS table_1
, 2 AS table_2
, 3 AS table_3
ORDER BY r_num
;Output:
R_NUM TABLE_1 TABLE_2 TABLE_3
0 AAEADP1 AAMAET1 AAPMED1
1 DOB_SOURCE EMPLOYEE_DOB EMPLOYEE_DATE_OF_BIRTH
2 EMP_DOB_SOURCE EMPLOYEE_FIRST_NAME_A_STD EMPLOYEE_FIRST_NAME
3 EMP_FIRST_NAME_A_STANDARDIZED EMPLOYEE_FIRST_NAME_B_STD EMPLOYEE_LAST_NAME
4 EMP_FIRST_NAME_B_STANDARDIZED EMPLOYEE_FIRST_NAME_SOURCE EMPLOYEE_SSN
5 EMP_FIRST_NAME_SOURCE EMPLOYEE_LAST_NAME_A_STD MPI
6 EMP_LAST_NAME_A_STANDARDIZED EMPLOYEE_LAST_NAME_B_STD PATIENT_DOB
7 EMP_LAST_NAME_B_STANDARDIZED EMPLOYEE_LAST_NAME_SOURCE PATIENT_FIRST_NAME_A_STD
8 EMP_LAST_NAME_SOURCE EMPLOYEE_NON_SSN_ID PATIENT_FIRST_NAME_B_STD
9 EMP_SSN_SOURCE EMPLOYEE_SSN_SOURCE PATIENT_FIRST_NAME_SOURCE
10 EMP_SSN_STANDARDIZED EMPLOYEE_SSN_STANDARDIZED PATIENT_LAST_NAME_A_STD
11 FIRST_NAME_A_STANDARDIZED MPI PATIENT_LAST_NAME_B_STD
12 FIRST_NAME_B_STANDARDIZED MPI_OLD PATIENT_LAST_NAME_SOURCE
13 LAST_NAME_A_STANDARDIZED PATIENT_DOB PATIENT_SSN
14 LAST_NAME_B_STANDARDIZED PATIENT_FIRST_NAME_A_STD PRESCRIBER_LAST_NAME
15 LAST_NAME_SOURCE PATIENT_FIRST_NAME_B_STD
16 MPI PATIENT_FIRST_NAME_SOURCE
17 SSN_SOURCE PATIENT_LAST_NAME_A_STD
18 SSN_STANDARDIZED PATIENT_LAST_NAME_B_STD
19 PATIENT_LAST_NAME_SOURCE
20 PATIENT_SSN
21 PATIENT_SSN_STANDARDIZEDIf you don't want to see the r_num column, use your front-end to hide it (e.g., in SQL*Plus: "COLUMN r_num NOPRINT"), or do the pivot in a sub-query, and only select table_1, table_2 and table_3 in the main query.
As with all pivots, you have to hard-code an upper bound to the number of pivoted columns. I used 3 above. You could use 4, or 5, or 45, but you must specify exactly how many columns to display.
If you say there will be 3 tables, and there actually are more than 3, then the query will still run, but all the tables after the first 3 will be ignored.
If you say there will be 3 tables, and there actually are fewer, then the query will still run, but you will have NULL columns at the end of each output row.
This sorts the output alphabetically by table_name and column_name. You can sort by anything you want by changing the analytic ORDER BY clauses. For example, if you are using all_tabl_columns and you want the columns to appear in order by column_id, then you would say:
, ROW_NUMBER () OVER ( PARTITION BY table_name
ORDER BY column_id -- instead of column_name
) AS r_num -
How to migrate SQL serveer table-valued functions into Oracle 10g
hi ,
i'm trying to migrate from SQL server to Oracle. There are some Table_valued functions ( Function that returns table). while migrating using SQL Developer it uses cursor for every table query. is this is the only solution to migrate functions returning table? This tables contains more than LAKH of records? so if there any other solution on this please reply. the sample code is bellow.
CREATE function FU_AIG_S_GET_LOG
returns TABLE
as
RETURN
SELECT U_AIG.T_AIG_LOG.AIG_LOG_NB_IDLOG,
U_AIG.T_AIG_LOG.AIG_LOG_NB_EVTSUIVI,
U_AIG.T_AIG_LOG.AIG_LOG_NB_CODELOG,
U_AIG.T_AIG_LOG.AIG_LOG_DT_CREATION,
U_AIG.T_AIG_LOG.AIG_LOG_CL_XMLEVT,
U_AIG.T_AIG_TYPELOG.AIG_TYPELOG_VC_NOMLOG
FROM U_AIG.T_AIG_LOG INNER JOIN U_AIG.T_AIG_TYPELOG
ON U_AIG.T_AIG_LOG.AIG_LOG_NB_CODELOG =
U_AIG.T_AIG_TYPELOG.AIG_TYPELOG_NB_CODELOG
WHERE AIG_LOG_NB_LU = 0;
thanks
sush
Message was edited by:
user610355
Message was edited by:
user610355I don't think there's good work around over that. Mysql .sql file syntax is a little different from Oracle. Especially the DDLs.
Unless you are willing to blindly run the .sql file and fix the one failed manually. -
Calling PL/SQL Functions And Open Oracle Reports From ADF Application
Hi all,
My company will convert some projects from Oracle forms to Oracle ADF so, we need to call the PL/SQL functions and open the Oracle Reports (which are already exist) from ADF Application.
Thank You..
Jack.NHi Jack.N,
calling PL/SQL Functions -----> http://sameh-nassar.blogspot.com/2010/01/create-plsql-function-and-call-it-from.html
Open Oracle Reports ---------> http://radio-weblogs.com/0137094/2008/06/15.html
You will find The Integration between ADF and other systems in ---> http://wiki.oracle.com/page/ADF+Integration
Sameh Nassar -
SQL Devloper Migration from SQL SerProcedurs created as Functions in Oracle
Hi All,
This is the first time I am using SQL Deveoper to migrate SQL Server database to Oracle.
I have SQL Developer 3 and I did migration from SQL Sever 2008 to Oracle 10g using online migration.
Everything was done perfectly, but there are some extra tables created in Oracle which are not present in SQL Server database.
And also I observed lot of programs which are stored procedures in SQL Server are converted as functions in Oracle.
Does someone knows how to fix this problem.
ThanksHi,
A SQL*Server stored procedure can be converted to an Oracle function depending on how it is written and what it is doing. In the documentation -
Oracle® SQL Developer
Supplementary Information for Microsoft SQL Server and
Sybase Adaptive Server Migrations
In Chapter 3 in the section -
3.4.2 Function
It says under Table 3-6 -
In Microsoft SQL Server or Sybase
Adaptive Server, you can convert a stored
procedure to a function in Oracle because
the stored procedure in Microsoft SQL
Server or Sybase Adaptive Server can
RETURN an integer value to the calling
routine using a RETURN statement. A
stored procedure returns a status value to
the calling routine even in the absence of
a RETURN statement. The returned status
is equal to ZERO if the procedure
execution is successful or NON-ZERO if
the procedure fails for some reason. The
RETURN statement can return only
integer values
And what tables do you see in oracle that are not there in SQL*Server ? Some tables are created as part of the migration as they are needed to have the same functionality as in SQL*Server.
Does your migrated Oracle database work in the same way as the SQL*Server database ? If not, then please give use specific examples and we can follow up.
Regards,
Mike -
Convert columns to row equivalent to stragg function in oracle sql
Hi,
Sorry i forgot my Oracle version :
SQL> select * from v$version;
BANNER
Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - 64bi
PL/SQL Release 10.2.0.3.0 - Production
CORE 10.2.0.3.0 Production
TNS for 64-bit Windows: Version 10.2.0.3.0 - Production
NLSRTL Version 10.2.0.3.0 - ProductionI searched in google but i didn't found the solution.
I looking for a function in discoverer equivalent to stragg sql function.
Note : stragg function convert columns to rows.
Thanks
SELECT deptno, stragg ('-' || ename)
FROM emp_test
GROUP BY deptno;
DEPTNO STRAGG_STR
10 -CLARK-KING-MILLER
20 -SMITH-FORD-ADAMS-SCOTT-JONES
30 -ALLEN-BLAKE-MARTIN-TURNER-JAMES-WARD
3 rows selected.Edited by: Salim Chelabi on 2010-01-29 08:32Hi again,
*1- I created my function in my schema.*
CREATE OR REPLACE TYPE t_string_agg AS OBJECT
g_string VARCHAR2(32767),
STATIC FUNCTION ODCIAggregateInitialize(sctx IN OUT t_string_agg)
RETURN NUMBER,
MEMBER FUNCTION ODCIAggregateIterate(self IN OUT t_string_agg,
value IN VARCHAR2 )
RETURN NUMBER,
MEMBER FUNCTION ODCIAggregateTerminate(self IN t_string_agg,
returnValue OUT VARCHAR2,
flags IN NUMBER)
RETURN NUMBER,
MEMBER FUNCTION ODCIAggregateMerge(self IN OUT t_string_agg,
ctx2 IN t_string_agg)
RETURN NUMBER
SHOW ERRORS
CREATE OR REPLACE TYPE BODY t_string_agg IS
STATIC FUNCTION ODCIAggregateInitialize(sctx IN OUT t_string_agg)
RETURN NUMBER IS
BEGIN
sctx := t_string_agg(NULL);
RETURN ODCIConst.Success;
END;
MEMBER FUNCTION ODCIAggregateIterate(self IN OUT t_string_agg,
value IN VARCHAR2 )
RETURN NUMBER IS
BEGIN
SELF.g_string := self.g_string || ',' || value;
RETURN ODCIConst.Success;
END;
MEMBER FUNCTION ODCIAggregateTerminate(self IN t_string_agg,
returnValue OUT VARCHAR2,
flags IN NUMBER)
RETURN NUMBER IS
BEGIN
returnValue := RTRIM(LTRIM(SELF.g_string, ','), ',');
RETURN ODCIConst.Success;
END;
MEMBER FUNCTION ODCIAggregateMerge(self IN OUT t_string_agg,
ctx2 IN t_string_agg)
RETURN NUMBER IS
BEGIN
SELF.g_string := SELF.g_string || ',' || ctx2.g_string;
RETURN ODCIConst.Success;
END;
END;
SHOW ERRORS
CREATE OR REPLACE FUNCTION string_agg (p_input VARCHAR2)
RETURN VARCHAR2
PARALLEL_ENABLE AGGREGATE USING t_string_agg;
SHOW ERRORS
*2- I ran my query in my schema with sqlplus.*
SELECT deptno,ename,sal, string_agg(ename)over(partition by deptno) AS employees
FROM emp_test
order by deptno;
DEPTNO ENAME SAL EMPLOYEES
10 CLARK 2450 CLARK,KING,MILLER
10 KING 5000 CLARK,KING,MILLER
10 MILLER 1300 CLARK,KING,MILLER
20 JONES 2975 JONES,FORD,ADAMS,SMITH,SCOTT
20 FORD 3000 JONES,FORD,ADAMS,SMITH,SCOTT
20 ADAMS 1100 JONES,FORD,ADAMS,SMITH,SCOTT
20 SMITH 800 JONES,FORD,ADAMS,SMITH,SCOTT
20 SCOTT 3000 JONES,FORD,ADAMS,SMITH,SCOTT
30 WARD 1250 WARD,TURNER,ALLEN,JAMES,BLAKE,MARTIN
30 TURNER 1500 WARD,TURNER,ALLEN,JAMES,BLAKE,MARTIN
30 ALLEN 1600 WARD,TURNER,ALLEN,JAMES,BLAKE,MARTIN
30 JAMES 950 WARD,TURNER,ALLEN,JAMES,BLAKE,MARTIN
30 BLAKE 2850 WARD,TURNER,ALLEN,JAMES,BLAKE,MARTIN
30 MARTIN 1250 WARD,TURNER,ALLEN,JAMES,BLAKE,MARTIN
14 rows selected.
*3- I import this function in discoverer administration*
4- My problem :When i use the function string_agg(ename)over(partition by deptno) in discover deskto i got the error you can't use over in this place.
Any ideas.
Thank in advance.
Regards Salim. -
Convert substring function from SQL Server to Oracle
I am converting a large application written for SQL Server to Oracle and have encountered a difference in how the substring function is called between the two database systems.
In SQL Server:
select substring('xyz'1,2)
In Oracle:
select substr('xyz',1,2)
Is there a way to establish a user-defined operator to map the substring call to a substr call so I don't have to change the application code?
Is the user-defined function a way to do this?
Which is better?If you want to be able to use the code that has substring in it, without modifying it, and have it do the same thing as substr, then try running the script below. It will create a user-defined function named substring that will cause substring to act like substr.
CREATE OR REPLACE FUNCTION substring
(p_string IN VARCHAR2,
p_start IN VARCHAR2,
p_end IN VARCHAR2 DEFAULT NULL)
RETURN VARCHAR2
IS
v_string VARCHAR2 (100);
BEGIN
IF p_end IS NULL
THEN
SELECT SUBSTR (p_string, p_start)
INTO v_string
FROM DUAL;
ELSE
SELECT SUBSTR (p_string, p_start, p_end)
INTO v_string
FROM DUAL;
END IF;
RETURN v_string;
END substring;
null
Maybe you are looking for
-
Recently I bought my macbook with retina display and when I plugged it into the television with using the HDMi cord it worked perfectly fine with the image on the television. But now I when I plug it in to the television it comes up with a black scre
-
Where can I download old version of adobe connect mobile app?
We are using old version of Adobe connect Pro (version <7.5) The recent version of Adobe connect mobile app does not work with our server. I want to get old version of adobe connect mobile app. Thanks, JD Park
-
How to return URL of servlet path ?
Hello, I want to return the URL of current servlet path (such as "http://www.mydomain.com:888/servlet"). How can I do that ? thanks in advance...
-
How Install Oracle 10g Express Edition in english language?
hi all i download both files: http://www.oracle.com/technology/software/products/database/xe/htdocs/102xewinsoft.html Oracle Database 10g Express Edition (Western European) OracleXE.exe (165,332,312 bytes) Single-byte LATIN1 database for Western Euro
-
Netscape.javascript.JSObject without applets - Urgent!
Hi, I need to evaluate some Javascript expressions inside my java code... BUT my code is not inside an Applet class. Does anyone know how to do it? I chose to use the netscape.javascript package, it work well inside an applet.. but my application doe