SQL & PL/SQL :: Use Reg-Exp To Get Required Output?

Mar 11, 2013

Following query is giving me the required output but i want to use reg_exp from same output.

SELECT TO_NUMBER ((SUBSTR (narr,
INSTR (narr, '#') + 1,
(INSTR (narr, 'DT')) - (INSTR (narr, '#') + 1)
) "Bill No"
FROM (SELECT '25 NOS. BILL BOOK FOR FAISALABAD @80/- TH A.R. PRINTER AGST BILL#21 DT:31-01-2013 TH

[code]...

Required Output using Reg_Exp

SQL>/
Bill No
----------
21
9

View 6 Replies


ADVERTISEMENT

SQL & PL/SQL :: Required Expected Output Using Decode

Apr 2, 2012

Oracle version : Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Prod

create table plc_dw_dry_run_fic_rfsh (dry_run_fic_id number,ltr_code varchar2(10),
next_cpn_lvl_id1 number,next_intrvl_code varchar2(10), next_intrvl_value varchar2(120));

begin
insert into plc_dw_dry_run_fic_rfsh values (424740,'1','','LTML','48000');
insert into plc_dw_dry_run_fic_rfsh values (424736,'1','','LTML','32000');
insert into plc_dw_dry_run_fic_rfsh values (424738,'1','','LTML','128000');
insert into plc_dw_dry_run_fic_rfsh values (424783,'1','','LTML','96000');
insert into plc_dw_dry_run_fic_rfsh values (424789,'2','','LTML','96000');
insert into plc_dw_dry_run_fic_rfsh values (424750,'1',198,'LTML','10000');
insert into plc_dw_dry_run_fic_rfsh values (424760,'1',199,'LDFM','20000');
insert into plc_dw_dry_run_fic_rfsh values (424770,'1','','LTML','192000');
end;

commit;

Expected output
---------------
DRY_RUN_FIC_ID LTR_CODE NEW_LTR_CODE
424740 '1' '1b'
424736 '1' '1'
424738 '1' '1'
424783 '1' '1a'
424789 '2' '1a'
424750 '1' '1a'
424760 '1' '1a'
424770 '1' '1a'

Rules
---------
1) First next_cpn_lvl_id1 should be considered (next_intrvl_code can be anything), if next_cpn_lvl_id1 is 198 or 199 then new_ltr_code should have 1a.

2) If next_cpn_lvl_id1 is not 198 or 199, then next_intrvl_code should be considered

a) if next_intrvl_code is LTML and mod of next_intrvl_value and 96000 is zero then new_ltr_code should be 1a
b) if next_intrvl_code is LTML and mod of next_intrvl_value and 48000 is zero then new_ltr_code should be 1b

3) If 1 & 2 are not satisfied, ltr_code should be assigned to new_ltr_code.

View 14 Replies View Related

SQL & PL/SQL :: How To Print The Multiple Output Statements In Single Output

Jul 1, 2013

DECLARE
JOBSFILE UTL_FILE.FILE_TYPE;
-- TAKE ALL JOB TITLES FROM JOBS
CURSOR JOBSCUR IS
SELECT *
-- DDOCNAME,DDOCTITLE,DSECURITYGROUP,DDOCAUTHOR,DDOCTYPE,DINDATE,PRIMARYFILE,EXTRACTIONDATE,BATCH_ID
FROM TARGET_UCM ;
[code].......

this is my plsql here to print table values i am using many utl_file.put_line statements is there any way to print all table values in a single utl_file.put_line.

View 2 Replies View Related

SQL & PL/SQL :: Splitting 1 Output Row Into 3 Output Rows

Sep 25, 2013

Currently I have a requirement where I need to create 2 more output rows using each result row.

In my requirement I am populating charges table with types of charges, on each line item of charges, I need to apply 2 types of taxes and populate it along with the charge line item. I will be storing charges in table charges and the 2 taxes to be applied in taxes table respectively. For each row of charges, i need to apply these 2 taxes present in taxes table resulting in 3 rows output.

--Create tables charges
create table charges
(
charge_type varchar2(10) ,
charge number
);

[Code]....

My expected output should be like below:

Item_type amount
-------------------- ----------
charge1 100
Charge1_tax1 10
Charge1_tax2 20
charge2 200
Charge2_tax1 20
Charge2_tax2 40

how I can achieve the expected output using a single sql query

View 6 Replies View Related

Required Database 10.2.0.4 For Linux 64 Bit

Oct 8, 2012

We are planning Database Migration From Windows to Linux Using RMAN..We required Oracle database 10.2.0.4 for Linux 64 bit.

View 3 Replies View Related

SQL & PL/SQL :: How To Use Substr To Get Required Result

Jan 7, 2013

i have following table

CREATE TABLE THREAD_SHADES
(
ITM_COD NUMBER NOT NULL,
ITM_DES VARCHAR2(250 BYTE) NOT NULL,
)

[Code]...

Result is

ITM_COD ITM_DES
80064186THREAD TEX-105 SHADE# 7921 (1500 MTRS)
80064187THREAD TEX-40 SHADE#7921 (3000 MTRS)
80114482THREAD TEX 40 SHADE C-8762 1500MTR LOCAL
80130541THREAD TEX-60 SHADE C8676 J&P COAST ASTRA 1000 MTRS

I want a query which should return only Sahde # from above data result must be as

7921
C-8762
C-8762
C8676

View 9 Replies View Related

SQL & PL/SQL :: Passing Required Parameter

Jun 14, 2011

I have a procedure with 20 parameters, acutely it is to update a table and each param represents respective columns in a table. I want to update only few selected columns(random), as of now am passing Null as param values for remaining.

Is there any way to ignore the unnecessary parameters instead of passing NULL value.My Proc call looks like...

Exec MyProce(IN_ID, NULL, NULL, NULL,NULL,NULL,'SOME_VALUE', NULL,NULL,NULL,NULL,NULL,NULL,...);

Or

Exec MyProce(IN_ID, NULL, NULL, NULL,'SOME_VALUE' ,NULL,'SOME_VALUE', NULL,NULL,NULL,NULL,NULL,NULL,...);

View 4 Replies View Related

CPU License Details Required

Aug 23, 2013

In our project we have many instance running with Oracle in one solaris zone. We are in the process of cost reduction so planning to bring the CPU in shared pool and reduce them.

if we can bring all the NUP (Named user Perception) CPU on one shared pool. Will it be cost effective and is there any problems in performing such change.

View 3 Replies View Related

PL/SQL :: Distinct Preceding Value Required

Sep 12, 2012

Following on from this answered thread: (xmlagg(xmlelement) - Distinct Values Required..Whereby the last poster recommended the use of

RTRIM (
XMLAGG (
XMLELEMENT (
E,
XMLATTRIBUTES (segment1|| ',' AS "Seg")
)
ORDER BY segment1 ASC
).EXTRACT ('./E[not(@Seg = preceding-sibling::E/@Seg)]/@Seg'),
','
)

To get a distinct list of elements. Works great, but I actually need to use the concept of "distinct immediately preceding".

Sample data:

create table xml_test
(emp_number number, seq number)

insert into xml_test values ('12345',1);
insert into xml_test values ('23456',2);
insert into xml_test values ('44323',3);
insert into xml_test values ('12345',4);
[code]....

View 7 Replies View Related

Database Size Required For SOA?

Jun 19, 2012

I will be installing SOA Suite with OSB in Exalogic for testing. It is not for the production environment and very simple application will be used for testing. Database admin asked me what size database would be required but I did not find clear answer in the documentation anywhere.

View 0 Replies View Related

SQL & PL/SQL :: Split A String As Per Required Format

Dec 23, 2010

Split a column with values like 1-2-21-3 into 001-002-21-003 (ie format required is 000-000-00-000) using sql.

View 3 Replies View Related

SQL & PL/SQL :: Merge Statement Required With Logic

Jul 10, 2013

Table Name: F_SCENARIO
System : Dataware house
Oracle version : 11g
Record Count : 2 Million records

Correct scenario records

F_Key F_Bridge_key Record_type
1 1 1
2 1 2
3 1 3

Wrong scenario records

F_Key F_Bridge_key Record_type
1 1 1
2 -5 2
3 -6 3

I want to write a Merge statement to update the negative values into 1.

View 6 Replies View Related

SQL & PL/SQL :: Query To Select Required Translators

Jul 13, 2010

i have a good query but I thought i know the solution but actually I didn't it's very simple and straight forward but i didn't catch the rope terminal to follow now I have the following code

CREATE TABLE TRANSLATORS
(Tr_code VARCHAR2(8),
Tr_name VARCHAR2(50),
Tr_age number(2),
Tr_location varchar2(25),
constraint PK_TR_CODE PRIMARY KEY(Tr_code)
);
[code]....

NOW I NEED A QUERY which will select the only translator who knows the languages written in where clause like if i specify two languages like 'italy' and 'english' the query should retrieve to me GH and SE also if i passed languages 'spainsh' and 'persia' it should return JH only

but if i passed languages like 'Italy' and 'Dutch' it should not return any thing (just : no rows selected)

View 14 Replies View Related

Networking And Gateways :: License Required To Use OID 11g

Apr 11, 2012

Im planning to install OID. I will use it for Oracle Net name resolution and Enterprise User Security.

How is this product licensed? Is it included in a enterprise rdbms license?

View 2 Replies View Related

Generate Trace File With Required Name

Jul 26, 2013

As a sys user i want to trace a user session. so i am using 

SQL> EXEC DBMS_SYSTEM.set_sql_trace_in_session(sid=>123, serial#=>1234, sql_trace=>TRUE);SQL> EXEC DBMS_SYSTEM.set_sql_trace_in_session(sid=>123, serial#=>1234, sql_trace=>FALSE); 

to trace. but this trace file is mixing with another trace files in udump. did some Google and found that we can use

ALTER SESSION SET TRACEFILE_IDENTIFIER = "MY_TEST_SESSION".

but this will generate trace file for sys user account not for the desired user session. how we can define trace file name for desired user session trace. 

View 2 Replies View Related

PL/SQL :: Space Required To Reduce Threshold?

Jul 3, 2013

There are tablespaces where the current usage is crossed 90% and we are getting alerts.I want to know how much space required to add for these tablespaces ( datafiles) so that  current usage can be reduced to 80 %. or 70 % Is the any SQL query to find this information . oracle 10 g database.  . 

View 5 Replies View Related

PL/SQL :: Privileges Required For Calling A Function

Sep 6, 2012

11.2

For procedures, we need to grant EXECUTE privilege.

For example:

grant execute on scott.process_salary to john;Lets say I have a function SCOTT.GET_EMPIDS and I want another user john to be able to invoke this fuction. So, what is the privilege that needs to be granted to John.

Is it SELECT or EXECUTE ?

grant select on SCOTT.GET_EMPIDS to john;or

grant execution on SCOTT.GET_EMPIDS to john;

View 2 Replies View Related

PL/SQL :: How To Display Required Data From Emp Table

Dec 26, 2012

This is my first post in this portal. I want display the details of emp table.. for that I am using this SQL statement.

select * from emp where mgr=nvl(:mgr,mgr);

when I give the input as 7698 it is displaying the corresponding records... and also when I won't give any input then it isdisplaying all the records except the mgr with null values.

1)I want to display all the records when I won't give any input including nulls
2)I want to display all the records who's mgr is null

Is there any way to incorporate to include all these in a single query..

View 9 Replies View Related

Query Return Results That Contain Duplicates - Only First Or Last Required

May 27, 2008

I have this query that returns results that contain duplicates(somewhat). I only want either the FIRST or LAST (either one is fine). Here is the query:

select unique PLLA.attribute4, PLA.item_description from po_lines_all PLA, po_line_locations_all PLLA
where PLLA.po_line_id = PLA.po_line_id
and PLLA.attribute4 is not null

So my output is something like this:

RCE12 This is an item for AUL1
RCE13 This is an item for PWEILL
RCE14 This is an item for AUL1

I just want either the RCE12 or RCE14 record and not both since they both have the same description.

View 2 Replies View Related

Massive Delete (2 Joins Required) With No Partitioning

Oct 25, 2011

I'm experiencing some infinite loop for my delete. I tried many way to deal with this problem but still take too much time. I will try to be clear as possible.

I have 4 implicated table in this problem.

The deletion is done depending of the pool_id given

Table 1 contain the pool_id
Table 2 the ticket_id foreign join ticket_pool_id with the pool_id
Table 3 ticket_child_id foreign join ticket_id with the ticket_id
Table 4 ticket_grand_child_id foreign ticket_child_id join with the ticket_child_id

Concerned count for each
table 1---->1
table 2---->1 200 000
table 3---->6 300 000
table 4---->6 300 000

So in fact it`s 6.3M+6.3M+1.2M+1 row to be deleted

Here`s the constraint :
-No partintionning
-Oracle version 9
-Online all the time so no downtime neither CTAS
-We cannot use cascade constraint
-The normalization is very important

Here`s what I tried:
-Bulk delete
-Delete with statement (In and Exists clause)
-temp table for each level and 1 level join
-procedure and commit each 20k

None of those worked in a decent time frame like less then one hour. The fact that we cannot base a delete on one of the column value is not working. Is there a way I'm getting desperate now

View 3 Replies View Related

Performance Tuning :: ORA-02017 / Integer Value Required

Nov 28, 2012

Recent events at work are forcing me to take a much closer look at hash joins in an attempt to understand them much deeper than just on the surface. But my question today is maybe simple. I have done lots of reading and can't for the life of me figure out how to get more memory to my HASH JOINS.

is there are way to get around this limit of 2GB on a box that has 64GB with some 20gb not in use?

1) my databases are all using workarea_size_policy=AUTO

2) I am not afraid to go back to =MANUAL and set my own work area sizes.

3) It seems I cannot set HASH_AREA_SIZE to more that about 2GB.

BANNER
--------------------------------------------------------------------------------
Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
PL/SQL Release 11.2.0.2.0 - Production
CORE 11.2.0.2.0 Production
TNS for Solaris: Version 11.2.0.2.0 - Production
NLSRTL Version 11.2.0.2.0 - Production
18:40:31 SQL> alter session set hash_area_size = 6000000000 ;
alter session set hash_area_size = 6000000000
*
ERROR at line 1:
ORA-02017: integer value required

I know there is a limit of about 2GB on my box for HASH_AREA_SIZE and setting it to 2GB works fine. But it is still not enough.

18:50:22 SQL> alter session set hash_area_size = 2147483647;
Session altered.
Elapsed: 00:00:00.23

is there are way to get around this limit of 2GB on a box that has 64GB with some 20gb not in use? Using hash_area_size and 2GB, I get better performance than with my current PGA_AGGREGATE_TARGET doing the allocation for me.

I think I'd like to get as much as 20GB to specific sessions for hash joins but maybe I am pipe dreaming?

NAME TYPE VALUE
------------------------------------ ----------- -------------------
_pga_max_size big integer 1258280K
pga_aggregate_target big integer 6G

View 5 Replies View Related

Server Administration :: Database Shutdown Is Required Or Not

Apr 24, 2011

We have 2 Unix SunOS server, named as SUNOS01 and SUNOS02, there is some space need to add in SUNOS02 and for that I have to bring Database down on SUNOS02. When I checked I found that the DB is pointing to SUNOS01, i.e. there is no DB on SUNOS02, So, Do I required to shutdown the DB on SUNOS01 or it is not required to do anything from Database side. I mean to say should I ask Unix team to bring down the unix server and add the space.Also, if DB shutdown is not required then what I have to do afetr they have added space and bring the server up from DB side.

View 4 Replies View Related

Server Administration :: Privileges Required For Export

Dec 1, 2011

I have one question regarding privileges required for export.I read in a document that

Quote:
If you do not have the system privileges contained in the EXP_FULL_DATABASE role, you cannot export objects contained in another user's schema. For example, you cannot export a table in another user's schema, even if you created a synonym for it.

what are the system privileges required in EXP_FULL_DATABASE role to perform export objects contained in another users schema?

View 2 Replies View Related

SQL & PL/SQL :: Privilege Required To Gather Table Statistics?

May 14, 2011

What privilege is required to gather table statistics using dbms_stats ?

View 2 Replies View Related

Forms :: Migrating From Oracle 8i To 10g - Update Required?

Jul 1, 2010

I am using oracle 8i (8.1.7) with forms 5 and reports 3 on a windows 2000 platform. Now I want to migrate from 8i to 10 g. Will the applications in form 5 and reports 3 work or should I have to upgrade the forms and reports as well.

View 4 Replies View Related

SQL & PL/SQL :: How To Send SMS Through Oracle - Special Modem Required?

Sep 21, 2011

I want to know how to send SMS through Oracle. What hardware do I need e.g do i required special modems etc. I want to send sms of payslips to employees. What will be the package for that.

View 2 Replies View Related

PL/SQL :: Delete Data Not Required Retaining Rows

Mar 18, 2013

CREATE TABLE "TEST_JET" ("K1" NUMBER, "K2" NUMBER, "K3" NUMBER, "K4" VARCHAR2(1)) ;
REM INSERTING into TEST_JET
Insert into TEST_JET (K1,K2,K3,K4) values (1,2,3,'I');
Insert into TEST_JET (K1,K2,K3,K4) values (1,2,3,'U');
Insert into TEST_JET (K1,K2,K3,K4) values (1,2,3,'D');
Insert into TEST_JET (K1,K2,K3,K4) values (1,2,2,'U');
Insert into TEST_JET (K1,K2,K3,K4) values (1,2,2,'D');
Insert into TEST_JET (K1,K2,K3,K4) values (1,3,5,'I');
Insert into TEST_JET (K1,K2,K3,K4) values (1,6,7,'U');
Insert into TEST_JET (K1,K2,K3,K4) values (1,6,7,'D');
Insert into TEST_JET (K1,K2,K3,K4) values (1,6,7,'T');
[code]....

based on the above result set , for a particular group ,only that op will be retained which comes out in the query . say for example , we have got 1,2,3,'D' for group 1,2,3

now since we have got the D Operation from the above query , i don't need the other two rows .i.e.
(1,2,3,'I');
(1,2,3,'U');

what is the best way to delete the data we don't want retaining the rows we want ,using a single sql statement . Also , for the result set row 7,7,7,T I first need to delete the group containing T operation, and insert two new rows .i.e. 7,7,7,D and 7,7,7,I .

View 14 Replies View Related

SQL & PL/SQL :: Display Data In Required Format By Select Query?

Dec 12, 2012

i like to display a Table data like the below format,

Output:

EMPNO JAN FEB MAR APR MAY JUN JUL AUG SEP OCT NOV DEC
00094 122 153 145 224 245 545 114 544 444 111 555 222
00095 233 123 145 224 205 545 114 444 444 111 555 222
00096 163 123 145 224 215 545 114 551 444 111 555 222
00097 163 0 145 224 215 545 114 551 444 111 555 222
conditions:

where condition:
where year = 2007

Table Structure:

create table HR_PAYSLIP
(
EMP_NO VARCHAR2(6) not null,
YEAR NUMBER(4) not null,
MONTH NUMBER(2) not null,
BASIC_PAY NUMBER(9,2),
)

Insert Command;

INSERT INTO PAYSLIP (EMP_NO, YEAR,MONTH,BASIC_PAY)
VALUES(00046, 2007, 1, 2314);

Pls Note: The above table data i have mentioned is an example with employee numbers and the basic_pay for all months in the particular year 2007, the employee no may be more and that must be displayed only one time like above for year 2007, and if the basic salary is zero for a month then it should be displayed as zero for a particular month

So how to write a Query for that?

View 9 Replies View Related

Server Administration :: Tablespace Size Required To Be Increased?

Nov 19, 2011

I found some of the tablesapces whose used% exceeded 80%.Based on this output i thought of increasing the datafile.But there are many tablespaces of DATA1 whose autoextensible column some are set to NO, and some are set to YES. I believe we dont need to bother about the tablespace whose Autoextensible column set to YES as Oracle will automatically manage until the Maxsize of it. But some tablesapce of DATA1 are set to NO. Should i recommend to add size for this DATA1 tablespace whose autoextensible are set to YES/NO or leave it as it is.

Please see the column below.

Quote:
FILE_IDTABLESPACE_NAMESIZE(M)USED(M)FREE(M)MAX(M)AUTOEXTENSIBLE% USED
59DATA13276732741.1325.7532767YES100
60DATA13276732741.6925.1932767YES100
61DATA1327673274026.8832767YES100
76DATA13270032193.31506.560NO98
77DATA13270030858.51841.380NO94
78DATA13270029476.563223.310NO90

View 25 Replies View Related

Backup & Recovery :: Minimum Files Required To Open DB

Dec 26, 2012

what are the minimum files which are required to open the db ? take it as this

I have oracle installed in c drive. I have placed 3 datafile related to one tablespace say test: two in D and one in E. I have place 3 datafile related to tablespace say orcl : two in D and one in E.

my undo is in E scenario is that my E drive crashed . db is in no archive mode . no backup is there. to be more worst db shuts down abnormally. I want my db open with data of c drive and D drive.

View 3 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved