PL/SQL :: Ordered Number As Occurrence Changed

May 30, 2013

I have following data

WITH t AS
(
select 1 rn, 'A' val from dual UNION ALL
select 2 rn, 'A' val from dual UNION ALL
select 3 rn, 'B' val from dual UNION ALL

[Code]....

I need to calculate a new column "orderedRn" as

Rn  Val OrderedRn
------------
1       A   1
2       A   1
3       B   2
4       C   3
5       C   3
6       C   3
7       A   4
8       A   4
9       B   5
10     B   5

View 4 Replies


ADVERTISEMENT

SQL & PL/SQL :: Number Of Occurrence

Oct 29, 2010

I'm trying to find a way to see if a value occurs more than once in a string. I just need to know "T/F", or "Y/N", etc.

The string will be comma delimited.

String: '1,2,3,1'
Ans: "T"

String: '1,2,3,4'
Ans: "N"

They do need to match exactly. for instance

String: '1,2,3,1a'
Ans: "N"

Using some code I found on this site, I coded this but I'm sure there's a better way. Is there??

--Check for Duplicate combination row values
BEGIN
--Query will split the string into individual pieces.
--Group the pieces to see if any 2 rows are the same
--If no rows are the same then "no_data_found" exception is thrown
SELECT 'T'
INTO vResult

[Code]...

View 10 Replies View Related

SQL & PL/SQL :: Replace With The First Occurrence In The String

Nov 12, 2012

I am using regexp_replace function to replace the string between the double quotes with the first occurance but i am able to replace first occurance but I am not getting remaining string.

For example:

select REGEXP_replace('Parent.addChildByName("DS-Id of OAL(BROBA)")||parent.add("DS-Id of OAL(BROBA)")','["]:print:+:punct::print:*["]','XXXX') from DUAL

O/P: Parent.addChildByName(XXXX)

Expected O/P : Parent.addChildByName(XXXX)||parent.add("DS-Id of OAL(BROBA)")

View 4 Replies View Related

Ordered Hints In Oracle

Aug 5, 2007

There's a fairly popular Ordered Hint example on the web as follows:

<CODE>
select /*+ ordered use_nl(bonus) parallel(e, 4) */
e.ename,
hiredate,
b.comm
from
emp e,
bonus b
where
e.ename = b.ename
;
</CODE>

I would like to know what the "parallel(e, 4)" clause does. Where does the "4" come from? What is "parallel" here? I also have another question: If I have 5 tables--T_OREGON, T_UTAH, T_VIRGINIA, T_TEXAS, and T_OKLAHOMA--lined up in a join right behind a FROM, coming in at row counts of

T_OREGON: [a lot of rows; a lot more than T_UTAH]
T_UTAH: [smaller than T_OREGON] 40550 rows
T_VIRGINIA: 14 rows
T_TEXAS: 66 rows
T_OKLAHOMA: 8 rows
from T_OREGON or, T_UTAH ut, T_VIRGINIA va, T_TEXAS tx, T_OKLAHOMA ok...

my question is, if an Ordered hint can be used here, is it that the smallest table (in this case T_OKLAHOMA) gets placed first in the join and the rest of the table ascension in the join doesn't matter? Or is it that T_OKLAHOMA gets placed first in the join, followed by T_VIRGINIA [at 14 rows], followed by T_TEXAS, T_UTAH, and finally T_OREGON?

View 3 Replies View Related

SQL & PL/SQL :: Locate Occurrence Of Symbols Combination

Aug 5, 2011

My need is to locate an occurrence of symbols starting from "s." (non-capital letter), following by word (with any capital letter at the beginning) and ending with ", " (comma and space symbols).

Ex:

select 'jeklghje, s.Glkgje, u.slgjwek, 904869' as tt from dual union all
select 's.Tklgj, u.slgjwek, 23578, elslgjs' as tt from dual union all
select 's.klgj, u.ekgjes, 238573, dlsjkgj' as tt from dual

I'm looking for occurrence of "s.Glkgje, " and "s.Tklgj, ".

I think some combination of REGEXP_INSTR and REGEXP_SUBSTR should be useful, but I'm not familiar with these functions so good yet.

View 7 Replies View Related

PL/SQL :: How To Update Ordered List Having A Constraint

Dec 1, 2012

I have to update a column for all the records in the table with a unique contraint

ex-- select rec_no from tablename;

9
8
7
6
5

now i have to update this like

select rec_no from tablename;

8
7
6
5
4

but when i am doing update tablename set rec_no=rec_no-1 i am getting unique constraint error

View 11 Replies View Related

AWR Report (SQL Ordered By Physical Reads)

Aug 30, 2013

AWR Report regarding ' SQL ordered by Physical Reads (UnOptimized))'. SQL ordered by Physical Reads (UnOptimized)UnOptimized Read Reqs =

Physical Read Reqts - Optimized Read Reqs %Opt - Optimized Reads as percentage of SQL Read Requests %Total - UnOptimized Read Reqs as a percentage of Total UnOptimized Read Reqs Total Physical Read Requests: 3,311,261 Captured SQL account for 13.5% of Total Total UnOptimized Read Requests: 3,311,261 Captured SQL account for 13.5% of Total Total Optimized Read Requests: 1 Captured SQL account for 0.0% of Total UnOptimized Read ReqsPhysical Read ReqsExecutionsUnOptimized Reqs per Exec%Opt%TotalSQL IdSQL ModuleSQL
[code]....

I want to know what is the mean by 'UnOptimized Read Reqs' and 'Optimized Read Reqs 'Question 2) what is 'SQL ordered by Physical Reads tuning'.

View 2 Replies View Related

PL/SQL :: Remove Consecutive Occurrence From String?

Jun 4, 2013

version : Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production

i want to ,remove consecutive occurance from string

Example I/P: 'POWELL POWELL BRIAN K AND BONNIE POWELL JARRELL JARRELL'
to O/P : 'POWELL BRIAN K AND BONNIE POWELL JARRELL'I tried the below code is Working fine , But i wanted to do this using Regexp or Some other Better Method
WITH T

[Code]....

View 8 Replies View Related

PL/SQL :: Oracle Sql Get Data After First Occurrence Of Hyphen

May 29, 2013

I need oracle sql get data after first occurrence of hyphen.

source string:
abcd - efgh

I want everything after the "-"

View 17 Replies View Related

Performance Tuning :: SQL Ordered By Elapsed Time

Feb 2, 2013

Elapsed Time (s)CPU Time (s)Executions Elap per Exec (s) % Total DB TimeSQL IdSQL ModuleSQL Text

3,263 32 1 3263.49 2.79 3ta0ms19fvgds httpd.exe SELECT CASE WHEN COUNT >= 1...Elapsed
6,360 164 2 3180.17 5.44 51jx99dm0swv7 cpm_srvscript@ahcaxasmil1b (TNS V1-V3) SELECT /*+ CCL<PFT_GET_RP...

On AWR, I see two script that are out of ordinary, and I want to make sure that I interpret them correctly.

1) "Elap per Exec (s)" shows 3263.49 with 1 "Executions".
2) "Elap per Exec (s)" shows 3180.17 each execution with 2 "Executions".

Does this mean that this script ran for ~ 54 minutes (3263.49 / 60 seconds) for 1 "Execution" and ~ 53 minutes (3180.17 / 60 seconds) per each execution? I need to understand "Elapsed Time (s),CPU Time (s),Executions ,Elap per Exec (s), % Total DB Time" represent.

View 9 Replies View Related

SQL & PL/SQL :: ORDERED Hint - Using With Left Outer Joins

Nov 7, 2011

I am trying to understand "ordered" hint. I want to use it in my sql where I am using some left outer joins. I believe if I use this ordered hint it will be much faster.

But the problem is I am not able to understand the concept of this hint. As i did alot of search on this eveyone says it will be , even I got some similar references where it worked But I am getting contradicting explanation for on this.

View 5 Replies View Related

Application Express :: Highlight Words - Only First Occurrence?

Feb 14, 2013

'm using the "Highlight Words" column formating for a report. There, I'm using the item syntax: &P1_RENVOI. Problem is, when the report appear, only the first occurence of the value of item "P1_RENVOI" is in red for every field in that column.

Is this a normal feature or should all occurences be put in red?

View 0 Replies View Related

Server Utilities :: Export Data Ordered And Organized

Nov 29, 2011

is any way to export an Oracle database organized in manner that, both tables and constraints would be exported in the correct order.An easy sample:

- An database with 2 tables, with constraints between them. Table 1 has a FK on Table 2.

Is it possible to export both structure and data regarding the constraints, resulting in an script that makes it possibly to import it in a way that would not give me problems about constraints?

View 4 Replies View Related

Performance Tuning :: SQL Ordered By Elapsed Time And SQL Module?

Feb 24, 2013

Elapsed Time (s) CPU Time (s) Executions Elap per Exec (s) % Total DB Time SQL Id SQL Module SQL Text
2,423 1 3,919 0.62 1.83 gt49gg0fnc5x8 srv_dr@ahs (TNS V1-V3) UPDATE /*+ CCL<OENDB_FILE...
2,227 14 1 2227.16 1.68 bggfx8a04prj9 SQL*Plus select * from (select n.source...
.........

On [SQL ordered by Elapsed Time], [SQL Module] shows an indication that a SQL was executed by which process (i.e. srv_dr@ahs)outside of SQL*PLUS.If [SQL Modeule] shows as [SQL*Plus], does it mean the query was run in SQL*PLUS manually or directly?I have the SQL ID. How do I find out who, how, and exactly what time it was run?

View 5 Replies View Related

JDeveloper, Java & XML :: Regular Expression For Exact Word And Occurrence

Mar 15, 2012

I need to search a specific pattern from a source code. In word, I need to check whether "getCode" has been called or not, for all the string inside double-quote("). Following are sample code lines -

1.->if(val==23){ month_desc = "a sample data"; }
2.->if(val==23){ month_desc = getCode("a sample data"); }
3.->if(val==23){ month_desc = "a " + getCode("sample data"); }
4.->if(val==23){ month_desc = getCode("sample data"); var2="sample data2";}

Now, expression should be such that it will return true during check for 1, 3 and 4, although, for 3 & 4 getCode has been called for part of the String.

View 2 Replies View Related

Parameter Before It Has Been Changed?

May 17, 2010

let's say a parameter changed in the database ex: alter system set retention_target= 1500; and i want to know what was the old value before it has been changed ,

View 1 Replies View Related

SQL & PL/SQL :: Copy Row With One Value Changed?

Jun 10, 2011

I've got table rep184_mediate with columns

mydate (it should be changed [mydate + 1 day] when copying) and other columns (should be copied as is).

How do I perform this without writing name of each column?

View 3 Replies View Related

SQL & PL/SQL :: Column Names Are Changed

Jul 21, 2011

when we decribe one table structure, it shows the column name as below:

DUKEDMTS03DB01:SYS@TODS1> desc uet_rep.ECM_MAINTENANCE

Name Null? Type
----------------------------------------------------- -------- ------------------------------------
C1 NOT NULL VARCHAR2(15)
C2 VARCHAR2(254)
C3 NOT NULL NUMBER(15)
C4 VARCHAR2(254)
C5 NOT NULL VARCHAR2(254)
C6 NOT NULL NUMBER(15)
C7 NOT NULL NUMBER(15)
C8 NOT NULL VARCHAR2(254)

[Code]...

But, till yday it was showing the orignal column name..

View 3 Replies View Related

SQL & PL/SQL :: Ora-04062 Timestamp Changed

Apr 4, 2012

I had follwoing function

Create Or Replace Function Fin_Prd(V_Dte In Date) Return Number Is
V_Fin_Str Number;
Begin

[Code].....

The above function was running well. Today i have made some change as under

Create Or Replace Function Fin_Prd(V_Dte In Date,V_Rtn_Flg In Number Default 0) Return Number Is
V_Fin_Str Number;

[Code]....

Above function is created and working well when i use it in query in sql prompt or Toad. But problem is this that all function which used this are invalid and when i run report whose query use FIN_PRD then error is "Ora-04062. Timestamp of Fin_Prd has been changed".

View 6 Replies View Related

Add Changed Rows To Redo Log Files

Aug 29, 2012

I learned that Oracle uses supplemental logging mechanısm to add the changed rows to redo log files and identify the changed rows on target replication database? Is that mechanism mandatory to handle the replication of data between updated and back up databases?

View 1 Replies View Related

SQL & PL/SQL :: How To Identify Which User Has Changed Table Structure

Jun 21, 2012

a table structure is modified every now and then because of which the few packages get uncompiled. is there any way to monitor which user has changed table structure.

View 2 Replies View Related

Forms :: How Column Name Of A Database Can Be Changed At Runtime

Feb 20, 2012

My form has to go into two different environment in which the one column name of a table is different. datatype is same.

I would like to change the database column name of the item in the form for that block at run time.

View 2 Replies View Related

Server Administration :: DBname Changed From Pfile?

Apr 17, 2013

I am having few confusion on dbname, sid & tnsname.

rman target sys/oracle@suman auxiliary /

In the above command, "suman" is SID or Tnsname or dbname?

Bimistake, in my test database, i tried to change the DBname to suman from sumandb in pfile. After changing, i tried to startup database in nomount pfile but oracle through error that, unable to locate control file. Then, i remove the control files and tried to start database with nomount. Oracle through error about the control file.

This database, i had installed through DBCA. I want to know, where are all places where DBname reside?

Can i start database through pfile even if it is created through DBCA?

View 4 Replies View Related

Server Administration :: Which Initialization Parameter Can't Be Changed

Apr 29, 2012

which initializaion parameter cant be change after creating the database?

View 5 Replies View Related

Security :: See Who Or When Password Was Changed For SYS Or SYSTEM Account?

Nov 10, 2010

Is there a way to see who or when password was changed for SYS or SYSTEM account?

View 4 Replies View Related

Forms :: Error / Signature FNC_GET_DET Has Been Changed

Jun 15, 2013

I have created 1 function as below in database

FNC_GET_DETAIL(deptid number,p_pass varchar2 default 'Y', g_count out number ) return number;

I have called this function from my forms (Test.fmb) as below:

declare
g_count number;
p_deptid number;
l_ret number;
begin
l_ret := FNC_GET_DETAIL(p_deptid,'Y', g_count );
end;

now I compiled that form in RMP schema and run in the same schema it run fine.But same function i have created on another schema and copying same fmx in that runtime and trying to run ..It wont works.It throws error : Signature has been changed.

Later on i came to know that such error occurs jus becoz of 2nd parameter p_pass varchar2 default 'Y'.

View 1 Replies View Related

Server Administration :: How Table Owner Is Changed

Mar 21, 2012

I got query to investigate, how table owner is changed.

SQL> conn test/test
Connected.
SQL> create table guri(name varchar2(9));

Table created.

SQL> select table_name from user_tables;

no rows selected
SQL> conn /as sysdba
Connected.
SQL> select owner,object_name,object_type from dba_objects where object_name = 'GURI';
OWNER OBJECT_NAME OBJECT_TYPE
---------- ----------- ------------
CISREPLICA GURI TABLE

View 8 Replies View Related

Server Administration :: Sys Password Changed By System?

Feb 18, 2010

Here is an article to show a case when SYS password is changed by SYSTEM:

[URL]....

This behavior is not working on all the environments.

View 10 Replies View Related

Forms :: Taking Summary When Value In Field Changed?

Nov 25, 2010

I have a datablock like this

datablock name : jou_tra1_tab
No. of record dispalyed is 5

so datablock display like this

jtt_amt jtt_amt_1 ck_amt
jtt_amt jtt_amt_1 ck_amt
jtt_amt jtt_amt_1 ck_amt
jtt_amt jtt_amt_1 ck_amt
jtt_amt jtt_amt_1 ck_amt
----------------------------
ck_amt_tot

ck_amt is checkbox..
ck_amt_tot is total of jtt_amt_1 [but total only those record whose checkbox is checked]

My task is like this When i checked checkbox whatever value in jtt_amt transfer to jtt_amt_1 field

but i can change value in jtt_amt_1 field ...i want to take addition of that changed field and show that sumation in ck_amt_tot.

I write trigger when-checkbox-changed like this
-------------------------------------------------
IF :jou_tra1_tab.ck_amt = 'Y' THEN
set_item_INSTANCE_property ('jou_tra1_tab.jtt_amt_1',CURRENT_RECORD, UPDATE_ALLOWED, PROPERTY_TRUE);
:jou_tra1_tab.jtt_amt_1 := :jou_tra1_tab.jtt_amt;
else
:jou_tra1_tab.jtt_amt_1 := 0;
END IF;

and when validation item trigger for jtt_amt_1 :
--------------------------------------------------
IF :jou_tra1_tab.ck_amt = 'Y' then
:jou_tra1_tab.ck_amt_tot := :jou_tra1_tab.ck_amt_tot + :jtt_amt_1 ;
else
:jou_tra1_tab.ck_amt_tot := :jou_tra1_tab.ck_amt_tot - :jtt_amt_1 ;

But when i changed value in jtt_amt_1 field i cant get write summation .

View 1 Replies View Related

Result Changed Hostname To Match New Naming Scheme

Aug 11, 2010

I've got a oracle install [non production, but devel] that is a tad screwed up. We moved the box and as a result changed the hostname to match the new naming scheme. Ever since then OracleEM has been somewhat confused. In anycase, I don't want OEM anyways now. Plan is to learn SQLplus.

That being said I've used emctl to shut down dbconsole, but it seems there is something somewhere that keeps restarting 2 processes that like to sit around and take up 100% cpu. I can kill them, they stay dead for a few hours then crop up again.I was able to find this out about them:

[jmacdonald@devoracle ~]$ ps auxwww|grep 2033
oracle 20334 84.1 12.3 994052 255824 ? Rs Aug10 1740:43 ora_j000_orcl
oracle 20336 80.9 14.1 998140 294288 ? Ss Aug10 1674:18 ora_j001_orcl

And then this, which caused me to conlucde its OracleEM:

SELECT sess.process, sess.status, sess.username, sess.schemaname, sql.sql_text
FROM v$session sess,
v$sql sql
WHERE sql.sql_id(+) = sess.sql_id
AND sess.process in (20334,20336)
[code]...

View 6 Replies View Related







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