SQL & PL/SQL :: Find Occurrences Of Some String In DB Objects?

Jul 11, 2012

How can i identify all the occurences of raise_application_error(-20XXX, '<the message>'); within all database objects, and replace them with other text?

View 4 Replies


ADVERTISEMENT

Function To Replace All Occurrences Of A String?

Jan 9, 2007

Years ago, someone created a database in Oracle that was carried over and now sits in Oracle 10g. I am developing an application that queries this database and returns the result as XML.

Many (thousands) of rows have an item description that contains an ampersand. I want each of these pieces of data to have it written as & amp; (had to add a space so it would show up here, but you know what I mean) instead of &, but I don't feel like doing thousands of UPDATEs to change this.

Does Oracle have any global find/replace functions that I can call? I'd rather do one update statement that replaces all occurances of & with & amp; but I can't seem to find a function that will do this.

I'm thinking something that would work like:

UPDATE table SET column1=REPLACE(column1,oldstr,newstr);

View 4 Replies View Related

PL/SQL :: How To Search One String With Various Occurrences Using Regexp_substr

Aug 14, 2012

My Scenario is'....456re0,50kg400,500rfabs43qre30,25kg150,354rf658....'

there is possible,using regexp_substr or other way to get the values, 0,50 and 400,500 and 30,25 and 150,354? I'm using [^re]+[$kg] and the string comes, but only the first occurence..

View 5 Replies View Related

SQL & PL/SQL :: Finding Number Of Pattern Occurrences In String?

Feb 4, 2012

The code which I am working on consists of an incoming dynamic string which be in the form of binary digits. The max size of the string will be 12 digits. For example, the string can be '111011000001', '000000000000', '111111011111', etc.

I need to find the number of occurences of '111' in the incoming string. Say in the 1st example, result will be 1, in the 2nd example result will be 0, and in the third example, the result will be 3.

I have been trying to capture the string length and replacing the variables '111' to find the number of occurences, but it isn't giving me the result that I want. This is what I have tried

SQL> conn hr/hr
Connected.
SQL> show user
USER is "HR"

[Code]....

I searched the forum and found a similar topic, and following that guideline, I even tried dividing the string with the length of the pattern. It works in some scenarios (the first and second examples mentioned below), while it fails in some scenarios (third example mentioned below)

SQL> select (length('11101110111') - length(replace('11101110111','111','')))/length('111') as occurences from dual;

OCCURENCES
----------
3

SQL> select (length('110111110111') - length(replace('110111110111','111','')))/length('111') as occurences from dual;

OCCURENCES
----------
2

SQL> select (length('111111111111') - length(replace('111111111111','111','')))/length('111') as occurences from dual;

OCCURENCES
----------

SQL>

View 13 Replies View Related

SQL & PL/SQL :: How To Find Whether Exact String Is Present / Not In Given String

Mar 14, 2013

I'm facing some problem even after using INSTR function in Oracle.The problem is I have written the logic in the PL/SQL block which appends all the values fetched in a loop on the basis of whether the string is present or not.

For ex:

The first value fetched from the select query first is ABCDEFG which gets appended to a variable
The next value fetched is AB even this has to be appended to the variable since this exactly doesn't match with ABCDEFG.
The next value fetched is BCDEF even this has to be appended to the variable since this exactly doesn't match with ABCDEFG.
The third Value fetched is ABCDEFG this will not get appended presently according to the logic which is correct.

writing that piece of code to append the value fetched which doesn't exactly match with the existing string

View 3 Replies View Related

SQL & PL/SQL :: Find Dependent Objects?

Feb 9, 2011

Say i have a Procedure or package or any other stored subprogram, I need a script say to which i can pass this Procedure/Package/View etc name and then the code should give me the data results as which all other stored subprograms are used within the particular stored program name which we mentioned in our WHERE or Predicate clause

View 4 Replies View Related

Find Objects Containing A Specified Character Pattern

Mar 21, 2011

Is there a method or a tool out there that can do a search through an Oracle Schema to find objects ( tables, fields, stored procedures, etc) containing a specified character pattern ? For example : I would like to return all of the tables that contain fields containing the character string "ABC"

View 1 Replies View Related

PL/SQL :: Find ALL Objects That Point To One Column

Oct 15, 2012

Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
PL/SQL Release 11.2.0.3.0 - Production
CORE     11.2.0.3.0     Production
TNS for Solaris: Version 11.2.0.3.0 - Production
NLSRTL Version 11.2.0.3.0 - Production

I have multiple schemas, all which have tons of objects that point to one column of one table. I tried to look at v$sqltext, and v$sqlarea, but it doesn't seem to show as expected.

Is there a view that I can look at that will show me all the objects that relate to one column?

my situation. Had to change the data structure of this one column. Changed the default value from a Y to an L. I have packages, functions, triggers...etc... that deal with this one column. I need to ensure that I go through EACH one and edit them to reflect the change to the table column. And again, this spans multiple schemas that point back to it.

View 5 Replies View Related

SQL & PL/SQL :: Script To Find Out Objects Synonym And Privs

Jun 17, 2011

There are over 100 objects like tables,procedures,packages,triggers in my database.I am looking for a script/sql which should list out synonyms and grant privs on it.

View 1 Replies View Related

Networking And Gateways :: How To Find All The Objects Referring To DB Link

Aug 10, 2012

We have two schemas which earlier used to be separate databases. There were DB links created to access the objects from one schema to the other schema when they were separate databases.

Since now they are just 2 separate schema with in the same Database, we would like to remove the DB Links and create synonyms to access those objects. These DB links were used in code in many places, it is becoming tough to find a way to implement this.

how to find all the objects that are using these objects or all the places these DB likns were being used.

View 1 Replies View Related

Server Utilities :: Find All Objects Of Schema HR In Imported Database

Jul 25, 2010

I imported a schema HR from export DUMP ....i can find all the objects of schema HR in the imported database... but i got an error for a plan_table which is assigned to USERS tablespace in the source database.. ...

HERE COMES THE ERROR I GOT DURING IMPORT:

[oracle@localhost mom]$ imp file=exp_schema_ref.dmp log=imp.ref.log fromuser=hr touser=hr commit=y
Import: Release 10.2.0.1.0 - Production on Mon Jul 26 00:03:57 2010
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Username: sys/sys as sysdba

Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production With the Partitioning, OLAP and Data Mining options

Export file created by EXPORT:V10.02.01 via direct path
import done in US7ASCII character set and AL16UTF16 NCHAR character set
. importing HR's objects into HR
. . importing table "COUNTRIES" 25 rows imported
. . importing table "DEPARTMENTS" 27 rows imported
. . importing table "EMPLOYEES" 107 rows imported
[code]....

View 1 Replies View Related

SQL & PL/SQL :: Find A Match Within String And Compare?

Aug 2, 2012

Below is a column 'ADDR' with the data (single column)

ADDR
--------
/shared/Folder_1 :^BIAdministrator:^BIAuthor:^BIConsumer:BISystemUser:OracleSystemUser:System:weblogic: :F

[Code]....

View 2 Replies View Related

SQL & PL/SQL :: How To Manipulate String (Find And Replace)

Jun 29, 2012

I am required to manipulate a string in this way.For example ABCDEF)* to $ABCDEF). So I should find * and delete it and instead put $ in the beginning of string.

View 9 Replies View Related

SQL & PL/SQL :: How To Find Greatest Values In A String

Jul 22, 2011

I am trying to update the greatest value in a column from a string of other column.

Ex: f the value is shown 10M+16M+25M-DG, then populate 25 only

so for that I had written query as follows:

update ANCHOR set IEL_STRAND_SIZE= greatest(
substr
(REPLACE(REPLACE(REGEXP_REPLACE( F_TYP, '[A-Z]', '' ),'+',','),'-',','),
0,
length(REPLACE(REPLACE(REGEXP_REPLACE( F_TYP, '[A-Z]', '' ),'+',','),'-',','))-1))

The output is given as 10,16,25,but not as 25.so how could i write it?Do I need to implement procedure or arrays for it.

View 7 Replies View Related

SQL & PL/SQL :: Find A Negative Number In String?

Apr 24, 2012

I am currently working on a Data Dictionary project where we need to run a few rules against the give data sources to see if they all comply together.

One of the rule is to check if the no. is negative or not. So for that what I tried to do was to check if first the field is number or not and then check on if it is negative or not.

This is the code I am currently trying on and is not looking good.

SELECT 1 FROM DUAL
WHERE decode(DECODE( TRANSLATE('-123.45','-0.123456789',''), NULL, 1,0), 1,substr('-123.45',1,1) ,' ' ) = '-'

View 13 Replies View Related

SQL & PL/SQL :: Way To Find Out Ending Digits In A String?

Dec 5, 2012

Is there a way to find out the ending digits in a string?

Examples of input and outputs:
'ABC123' -> 123
'ABC' -> NULL
'123ABC' -> NULL
'123ABC456' -> 456
'123ABC456QP98' -> 98

I have figured a way to do it by doing Reverse and re-reversing using: reverse(regexp_substr(reverse(p_string), '[ [:digit:]]*'))

But I'm sure there is a way to do it backwards without using reverse function, which I am not able to properly put in the syntax.

View 3 Replies View Related

SQL & PL/SQL :: How To Find Out Lowercase Char In A String

May 16, 2008

How to find out lowercase char in a String in a SQL query

for example

"ORAclE" here c and l are lowercase so how can i find out this condition... is there any build in function in oracle?

View 13 Replies View Related

SQL & PL/SQL :: How To Find Any Character Is Repeating In A String

Sep 8, 2011

How to find whether any character in a string is repeating or not

Eg: '123LH563' should return 'YES' , as 3 is repating there
'1234567' sould return 'NO' as there is no character which is repeating

View 8 Replies View Related

PL/SQL :: Find And Replace Value In Delimited String

Sep 4, 2013

I have a requirement, where i need to find and replace values in delimited string. For example, the string is

"GL~1001~157747~FEB-13~ CREDIT~ A~N~ USD~ NULL~".

The 4th column gives month and year. I need to replace it with previous month name. For example:

"GL~1001~ 157747~ JAN-13~ CREDIT~ A~N~USD~NULL~".

I need to do same for last 12 months. I thought of first devide the values and store it in variable and then after replacing it with required value, join it back. I just wanted to know if there is any better way to do it?

View 10 Replies View Related

SQL & PL/SQL :: Find Packaged Procedures Names For Particular String

Nov 7, 2011

I want to search for some specific string in packaged procedures source code, and want to list the name of those procedures along with package names.

View 17 Replies View Related

SQL & PL/SQL :: How To Find Extended ASCII Characters From A String

Sep 19, 2013

I have a table like mentioned below

create table test1( test_no number, test_description varchar2(100));
insert into test1 values (1,'ABC£¥');
insert into test1 values (2,'BCD£¥');

Now I am selecting from the above table and the expected rest it should have shown is as shown below

TEST1
-----------------------
TEST_NO TEST_DESCRIPTION
1 ABC£¥
2 BCD£¥

But instead of showing the extended ascii characters, it is showing some different characters as shown below

select * from test1;

TEST1
-----------------------
TEST_NO TEST_DESCRIPTION
1 ABCLY
2 BCDLY

I have an requirement where i need to fetch the exact ascii characters for £ and ¥ instead of L and Y respectively.

View 1 Replies View Related

SQL & PL/SQL :: How To Find Nearest / Closest String For A Column Data

Jun 1, 2011

Quote: I have a table(table name is names) with column as name(varchar) . I have the following data for name column.

Miss
Mississ
Mississipp

I would like to find a nearest match for Mississippi, that means sql should return row that contains Mississipp( Row #3)

If I try to find nearest match for Mississirr then sql should return row that has column value Mississ (Row#2)
Is this possible ? Here is the code for table creation and data.

create table names (name varchar2(20));

insert into names values('Miss');
insert into names values('Mississ');
insert into names values('Mississipp');
commit;

View 2 Replies View Related

SQL & PL/SQL :: Multiple Values Of RULES Tables To Find Records Containing A String Format

Sep 4, 2013

Insert into PROFILE
(INSTANCE, PROFILENAME, USER_DATA, UPDATE_DATE)
Values
(138, 'Test A', 'SRC!-1,ARCHIVE_OPT!-1,DATE_FIELD!155,DATE_RULE!1,DISTINCT!1', TO_DATE('01/20/2005 13:35:33', 'MM/DD/YYYY HH24:MI:SS'));
/
Insert into RULES
(ID, NAME)
Values
(155, 'DATE_TEST');

I want a code something of this sort:

select profilename from PROFILE where user_data like '%DATE_RULE!115%';

Output will be "Test A".Now, this is just a single value from RULES table used to find the data of PROFILE table.I will have to run the query on multiple values of RULES tables to find records containing a string format of sort "DATE_RULE!<rule_no>". How to search on WILD CARDs like these?

View 5 Replies View Related

SQL & PL/SQL :: Counting Occurrences Of Max Value?

Feb 19, 2011

I have a table "exam results"

create table eresults
(student_name varchar2(20),
section_name varchar2(4),
exam_id NUMBER (4))
marks NUMBER (3))

[code]....

My requirement is that I need another column named "top scored" which will show how many times each student took highest marks for his Section in each exam_id"

For example in above data the following students "Top scored" for thier respective section in each exam_id:

STUDENT_NAME SECTION EXAM_ID
DOLLY A 1
RIZWAN B 1
PAUL C 2
ZAKIR D 2

[code]....

So, based on above my requirement is as below

STUDENT_N SECTION_NAME COUNT(EXAM_ID) SUM(MARKS) MAX(MARKS) top_scored
ALEENA C 2 147 91 0
ASIM D 2 68 45 1
ASLAM B 2 70 56 0
ATIF D 2 2 2 0
AYSHA B 2 114 78 0

[code]....

View 1 Replies View Related

SQL & PL/SQL :: Counting Followed Last Occurrences

Jul 4, 2013

the following conundrum.

Having the Following information:

Col A Col B
---------------
134 | 1049
0 | 1050
12 | 1051
0 | 1052
0 | 1053
0 | 1054
0 | 1055
0 | 1056
0 | 1057

What I want is to count the number of the similar occurrences on Col A starting from the bottom and stopping at the first that is different.

Taking the example above I would get 6, that is the number of repeated "0" from the last value "1057" until "1052".

View 15 Replies View Related

SQL & PL/SQL :: Multiple Occurrences In A Table

Feb 16, 2012

multiple occurrences in table. I have attached a sample table in csv format along with my code.

I'm trying to get all the information from the table where the section number occurs more than one time.

In my table SECTION 103 and 104 only occurs one time. I'm trying to eliminate 103 and 104. I only want to see sections that occur more than once.

Below is my

select a.term_code_key term, a.crn_key, a.seq_number_key section,
a.subj_code||'-'||a.crse_number subject, a.title,
a.actual_enrollment seats_filled, maximum_enrollment seat_cap,
a.seats_available empty_seats

[Code]....

View 6 Replies View Related

SQL & PL/SQL :: Duplicate Detection - Display All Occurrences?

Feb 24, 2010

For every record which came yeterday in table ABC, I need to find if same record data does exists in historical records of the same table, and if match is find, I need to display all the occurrences.

For example Data got inserted yesterday as
SQL RES : Col 1= "A" Col 2: "B" Col 3: "C" Date = Sysdate -1

then, I need to scan through Query results from the history where I can find if there exists same combination already.and if so I need to display both i.e Record form yesterday and from history.

Here is the one I am using to get the base data.
with base as(
select Col 1, Col 2, Col 3,A.Create_DT
from A,B
where A.ID = B.ID
)

View 20 Replies View Related

Text :: How To Get Number Of Occurrences Per Document

Nov 8, 2013

I have a table of documents (excel, word, pdf, txt) stored in blob column. I want that SCORE returns the number of occurrences within each document, so I'm using this piece of code: 

SELECT bdt.*, SCORE(1) AS score_1, DBMS_CRYPTO.HASH(archivo, 3) AS cod_hashFROM crg_ctx_archivos_recibidos bdt

WHERE CONTAINS(archivo,'<query>   <textquery lang="SPANISH" grammar="CONTEXT">DEFINESCORE(paz, OCCURRENCE * 0.1)</textquery>    <score datatype="INTEGER" algorithm="COUNT"/></query>', 1) > 0

ORDER BY SCORE (1) DESC; 

However I'm getting a maximum score of 10, but I know one of these documents have 490 matches. How can i get the exact number of matches per document? I'm using Oracle 11.2

View 3 Replies View Related

SQL & PL/SQL :: How To Get Total Number Of Occurrences Based On Value Of Column

Apr 20, 2013

I have a query that should return count the number of rows depending on the value of SLOT. The expected result will be like this:

WIPDATAVALUE SLOT N M
1-2 TRALTEST43S1 1 3
1-2 TRALTEST43S1 2 3
3 TRALTEST43S1 3 3
4-6 TRALTEST43S2 1 4
4-6 TRALTEST43S2 2 4
4-6 TRALTEST43S2 3 4
7 TRALTEST43S2 4 4

The M column is used to count the total number of occurrences of a SLOT. Now, as for the N field, this is used to count the occurrence of the SLOT. In my example for the SLOT TRALTEST43S1, it has three occurrences so M will be 3. Why 3, is because of the WIPDATAVALUE. The WIPDATAVALUE of TRALTEST43S1 is 1-2 and 3. 1-2 WIPDATAVALUE signifies two occurrences (one to two) and 3 signifies only one occurrence. As for N, it should just count the number of occurrence. To further explain, see below:

WIPDATAVALUE SLOT N M
1-2 TRALTEST43S1 1 3 -> First occurrence in the total of 3
1-2 TRALTEST43S1 2 3 -> Second occurrence in the total of 3
3 TRALTEST43S1 3 3 -> Third occurrence in the total of 3
4-6 TRALTEST43S2 1 4 -> First occurrence in the total of 4
4-6 TRALTEST43S2 2 4 -> Second occurrence in the total of 4
4-6 TRALTEST43S2 3 4 -> Third occurrence in the total of 4
7 TRALTEST43S12 4 4 -> Fourth occurrence in the total of 4

This is the query that I have so far:

SELECT DISTINCT
WIPDATAVALUE, SLOT
, LEVEL AS n
, m
FROM
(
SELECT
WIPDATAVALUE
, SLOT
, (dulo - una) + 1 AS m
[code]....

I think that my current query is basing its M and N results on WIPDATAVALUE and not the SLOT that is why I get the wrong output. I have also tried to use the WITH Statement and it works well but unfortunately, our system cant accept subquery factoring.

View 2 Replies View Related

SQL & PL/SQL :: Create A View To Show Counter For Occurrences?

Jul 24, 2011

I am trying to create view that selects a number of rows from a table and has a calculated field which is a counter form 1 to n next to each row.

In the below example, s_name is repeated many times each with a differnet serial, I want to cteate a view that shows a counter for the occurences of s_name next to the serial.

CREATE TABLE XYZ
(
SERIAL NUMBER PRIMARY KEY,
S_NAME VARCHAR2(30)
);
INSERT ALL
INTO XYZ VALUES (1, 'ABC')
INTO XYZ VALUES (11, 'ABC')

[code].....

View 3 Replies View Related







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