SQL & PL/SQL :: Search String From The End To Beginning (reverse INSTR)?

Sep 22, 2010

Trying to get a number out of an error backtrack

06512: at "SCHEMA.PROCEDURE", line 4

I only need to take the 4 out of this message. Of course the number might be anything from 1 to 10000.

The database languages might differ so I can't do this using

v_line_no:=SUBSTR(v_line_no,INSTR(v_line_no,'line')+5)

As it would not find any 'line' inside the string.

View 7 Replies


ADVERTISEMENT

PL/SQL :: Reverse Search In String

Aug 13, 2012

I have table having a single column a, which contain the values "HP Laptop", can search it in either way , i mean to say either user input the HP Laptop or Laptop HP? is it possible via SQL query ?

View 11 Replies View Related

SQL & PL/SQL :: Instr Versus DBMS_LOB.instr / Search A Pattern Backwards In A CLOB Field?

Mar 10, 2012

I need to search a pattern backwards in a CLOB field.Function DBMS_LOB.instr does not work with '-1' offset (where to start the search) as instr does.

Parameters: instr(text_to_be_searched, pattern, offset, nth)

Example: I want to search 'Hello world' for the first instance of the letter 'o' starting from the end, backwards.As you can see, result for DBMS_LOB.instr is null when entered -1 for offset.

select
DBMS_LOB.instr('Hello world','o',-1,1) lob_i,
instr('Hello world','o',-1,1) std_i
from dual;

View 6 Replies View Related

How To Make INSTR Search DISTINCT

Feb 9, 2010

I have a script that is using the INSTR function to search through a block of data for a specific string (CALL). I am ONLY looking for that string set but unfortunately, there are other words within that block of text that have that string set within it (e.g. CALL_MY_PHONE). Is there any way to make the INSTR search DISTINCT? Below is the code that I am using:

to_number(DECODE(INSTR(ph.block,'CALL'),0,0,1))

View 3 Replies View Related

SQL & PL/SQL :: How To Do Selective Search Within A String

Nov 8, 2010

Assuming I have the following table with its data:

Quote:

| code | description |
| A | $abc + xyz = $cba - 2 |
| B | ($12345 + $12345)/3 |
| C | $poke + $abc = $abc + 456 - 789 |

How can I do a selective search on "description" column for any word that starts with the "$" sign? In the end, this is the resultset that I am expecting:

Quote:
| $ | count of $ |
| $abc | 3 |
| $cba | 1 |
| $12345 | 2 |
| $poke | 1 |

View 5 Replies View Related

SQL & PL/SQL :: How To Search For A Particular Text In String Column

Oct 18, 2012

I have one table for eg. TB_Fruits.

In that i have one column FruitsName(Varchar)

In that column i am storing string in comma separated values.

Select FruitsName from tb_fruits;
Result: orange,banana,apple

Now the issue is suppose if i try to insert any of these fruits name again then it should not allow me to insert.

Suppose now if i try to insert ('grapes,banana')
or
('apple,grapes')

the orange,banana,apple can be in any position.

How to check if any of these names already exist or not in the column fruitsname?

I cannot use like or INstr function here. because the position is not fixed not even string.

View 1 Replies View Related

SQL & PL/SQL :: Search For A Pattern And Replace With A String?

Jun 20, 2012

I want to search for a pattern and replace with a string. I can easily achieve the same in oracle 10g with REGEXP_REPLACE , I want to get the similar solution in 9i.

Eg.

I have to search for a string pattern 1234 5678 9012 6736 , I want to replace the same with XXXX XXXX XXXX XXXX.

View 8 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 :: Search A String In TEXT Column Of Dba_views

Aug 4, 2010

I want to select the view names from text column in dba_views.

View 7 Replies View Related

Application Express :: How To Search Tree With A Given String

Oct 31, 2013

How can I search the tree with a given string?I don't find any function like "search(...)".I want to find the tree nodes which include the given string. 

View 5 Replies View Related

PL/SQL :: String Search Query In Any Columns / Table In Database?

Sep 4, 2012

I am trying to search a word which starts with 'FRA' in any columns and any tables.

I am unable to find what is generating a join datasets in the webservice from teh database as it is not apparent within the 100 tables.

I ahve looked into

Re: How to search in all rows and all columns?
Re: SQL Search Query?

but none of these queries is working out for me as I am a user with no tables on its own but rather a user quering other tables.I think its a tweak on which dat a dictionary I can view

select distinct substr (table_name, 1, 14) "Table",
substr (t.column_value.getstringval (), 1, 50) "Column/Value"
from all_cons_columns,
table
(xmlsequence
(dbms_xmlgen.getxmltype ('select ' || column_name
|| ' from ' || table_name
|| ' where upper('
|| column_name
|| ') like upper(''%' || 'fra'
|| '%'')'
).extract ('ROWSET/ROW/*')
)
) t
order by "Table";

running teh above query got me thsi error:

ORA-19202: Error occurred in XML processing
ORA-00942: table or view does not exist
ORA-06512: at "SYS.DBMS_XMLGEN", line 288
ORA-06512: at line 1
19202. 00000 - "Error occurred in XML processing%s"
*Cause:    An error occurred when processing the XML function
*Action:   Check the given error message and fix the appropriate problem

View 4 Replies View Related

Windows :: How Search Specific String In PDF File From Command Prompt

Nov 21, 2012

I have a requirement in which i have list pdf files(from thousands of pdf files) having particular string from a command prompt.I have tried find command but that has some limitation. its working upto 3 digit string only.how can i acheive this.remember i have to do this through command prompt only.

View 1 Replies View Related

SQL & PL/SQL :: Query A Table Beginning With @

Feb 29, 2012

I am using Oracle SQL developer 3.0.0.4. I have tables starting with @. For eg @45412_USERS

I am getting the below error when i run select * from @45412_USERS;

It says ORA-00903: invalid table name
00903. 00000 - "invalid table name"
*Cause:
*Action:
Error at Line: 7 Column: 14

I also tried with select * from <Owner>.@45412_USERS this also didnt work.

View 4 Replies View Related

PL/SQL :: Have A Function In Oracle To Select Not Null Columns At Beginning

Jul 12, 2012

I have 8 columns. Some of them might be null.I want to display all 8 columns in my result. Not null columns will be first and null at the end.

Here is a sample data :

Employee table :
Employee_id   Emp_fname  emp_lname  emp_mname  dept salary emp_height  emp_weight
   1               aaa        ddd                d1   100      6           180
   2               bbb                ccc             120                 169
   3               dfe                           d2            5.9         223

The expected result is :
result1 result2   result3 result4  result5  result6 result7 result8
1        aaa        ddd     d1       100     6        180
2        bbb        ccc     120      169
3        dfe        d2      5.9      223

View 13 Replies View Related

Application Express :: Enable IR Search Field To Search In Hidden Columns

Jul 15, 2012

I am using apex 4.1. I must hide phone number columns in my IR report, but at the same time the values of that columns should be available to search for using IR Search Field. is there a way to do this ?

if not, that means I have to :

1- Add a text filed P1_PHONE
2- edit my report query to something similar to
> Select * from Table where :P1_phone in (mobile1,mobile2) or :p1_phone is null
3- add button to refresh the report.

but the item P1_PHONE should be on the header of the Report region. is there a way to do this.
I am using theme 23
page template without sidebars
Report template : Reports Region.

how to put the item P1_PHONE on the tab of the page. Just similar to the Search item of in the Application Builder.

View 7 Replies View Related

When To Use A Reverse Key Index

Jul 3, 2012

I've read some documentation about the reverse key indexes, but I haven't understood when really it can be useful use them. when it's smart to use them according to your experiences?

View 4 Replies View Related

SQL & PL/SQL :: Column Reverse In Record?

Nov 7, 2011

I am trying to reverse data from couple record. I have display the output below of how I want it to be and is it possible to do it?

Quote:

This is how it is right now

ID|FROM_UOM_KEY|UOM_KEY|UOM|QUANTITY
1 |PK |PK |PK |1
2 |EA |PK |PK |3
3 |PK |PK |PK |1
4 |EA |PK |PK |3

I want it to be like this.

ID|FROM_UOM_KEY|UOM_KEY|UOM|QUANTITY
1 |EA |PK |PK |1
2 |PK |PK |PK |3
3 |EA |PK |PK |1
4 |PK |PK |PK |3

Here is the code

SELECT
from_uom_key,
vip.UOM_KEY,
--DECODE ( from_uom_key,from_uom_key,vip.UOM_KEY,from_uom_key),

[Code]....

View 21 Replies View Related

Create Reverse Key Index On Table

Feb 25, 2013

difference between the ways we create Reverse Key Index on the table.The two ways are as below:

1) CREATE INDEX <Index_Name> ON <Table_Name>(<Column_Name) REVERSE ;
2) CREATE INDEX <Index_Name> ON<Table_Name>(REVERSE(<Column_Name>)) ;

Which one is the appropraite one.
Are both going to act in the same way.

I created index in both ways one by one on the table.But when I fire the select statement against the same table, The explain plan doesn't show any cost and it shows the full table scan in both ways.The select statement used is as below...I want to compare the column with string RBO(i.e('RBO%') at the start.

SELECT *
FROM <Table_Name>
WHERE REVERSE (<Column_Name>) LIKE '%OBR' ;

The select statement is giving me the correct result. Only the explain plan is showing Full Table Scan.can we use this reverse with IN operator also in the same way by reversing the values.

View 3 Replies View Related

SQL & PL/SQL :: INSTR With Replace Function

Aug 27, 2013

I am trying this function

instr(','||replace(r_code,' ') ' ' || ', ' , ',' ||r_code || ' , ' )=0

i want to hardcode 'a1', 'a2' from r_code i dont want records from a1, a2

View 1 Replies View Related

How To Use Substr / Instr To Isolate

Aug 28, 2012

i need to isolate the MVNAME schema from the following job;

dbms_refresh.refresh('"SCHEMA"."MVNAME"');

how to use substr/instr to isolate it?so far I have

select substr(what,instr(what,'"',-1,2),15) from dba_jobs;

View 3 Replies View Related

Forms :: Why Arabic Comma Reverse Text

Mar 2, 2012

The Text is displayed correctly when there is no "Arabic comma" ، , otherwise the text will be reversed, How can I avoid the issue, why we have such problem only when we add the comma. The screenshot: s10.postimage.org/8qw1l8621/Arabic_comma.png

View 3 Replies View Related

PL/SQL :: Reverse Update - Create Synonym In Different Schema

Aug 8, 2012

I have table a in database 1 . Now i have created the MV for table a in database 2.

then i am going to create a synonym in different schema in the database 2.

Now i want to update the synonym in database 2 the same as to refresh in table a database 1.

How to achieve this??

View 2 Replies View Related

SQL & PL/SQL :: Instr Function And Index Usage

Apr 14, 2012

I have a requirement where the user input values will be passed as comma separated string to backend, which is queried against the table using instr. But the index present on the table is not using the index , due to the instr function.How can I create a index in such a way that The instr function uses it.

CREATE TABLE TEST_IDX
(
CCN VARCHAR2(10 CHAR),
SKU_NUM VARCHAR2(10 CHAR),
MOD VARCHAR2(10 CHAR),
SKU_STATUS VARCHAR2(2 CHAR),
RPT_FLAG VARCHAR2(2 CHAR),
CYCLE_AS_OF_DATE DATE,
SMP_IDENTIFIER NUMBER,
MEASURE_NAME VARCHAR2(100 CHAR)
);
CREATE INDEX TEST_IDX1 ON TEST_IDX
(CCN, SMP_IDENTIFIER, MOD, CYCLE_AS_OF_DATE, RPT_FLAG,
MEASURE_NAME);

The below query is going for full table scan due to this.

select * from test_idx where (INSTR (','||'E10000'||',', ',' || ccn || ',') <> 0 OR 'E10000' = 'DEFAULT')
and mod='90396' and rpt_flag='O' and smp_identifier=2

how to recreate the above index so that these queries uses this index.

View 16 Replies View Related

SQL & PL/SQL :: Substr And Instr In Update Statement

Nov 28, 2010

I have a table1 with columns serial no and name as below

serial no name
1 john paul
2 john victor

and i have another table1 with columns serialno,firstname and second name as below

serial no firstname secondname
1
2

I want to update my table2 with the name from table1 and divide and insert in first name and second name as below

serialno firstname secondname
1 john paul
2 john victor

i use the query as below

update table2 set
firstname = (select substr(name, 1, instr(name, ' ', 1) - 1)
from table1
)

but the above query not worked.

View 11 Replies View Related

SQL & PL/SQL :: SUBSTR / INSTR - Isolate MVNAME Schema?

Aug 28, 2012

i need to isolate the MVNAME schema from the following job;

dbms_refresh.refresh('"SCHEMA"."MVNAME"');

how to use substr/instr to isolate it?so far I have

select substr(what,instr(what,'"',-1,2),15) from dba_jobs;

But its proving a bit tricky to nail it.

View 6 Replies View Related

SQL & PL/SQL :: Order Of Bytes Returned By Dump() Function In Reverse Key Indexes?

May 28, 2013

Oracle Version: 11gR2: 11.2.0.1.0 - 64bit
OS: Linux Fedora Core 17 X86_64

Currently, I'm reading the online book Oracle Concepts, Chapter 3: 3 Indexes and Index-Organized Tables, section: Reverse Key Indexes in order to understand this topic.

As I understand for each pair of (key, rowid) in the index structure, the rowid for each row in the table obviously remains the same but the bytes of the key are reversed before the key is stored. So for example on a 32 bit machine (just an example) a key = 10 AB CD EF will be stored as FE DC BA 01 , am I right?

According to the documentation, this becomes interesting in RAC environments in order to remove a hot spot from the index (when multiple instances repeatedly modify the same block) with the disadvantage that in some cases there cannot be Index Range Scan any more as data in the index is not sorted by column key when it is stored.

I was just curious to see how bytes of each key are reversed and after a bit googling I found an article where Tom Kyte shows with an example by using dump function (which as I understand gives the internal representation of a given expression) the difference in the sequence of bytes. Here is the link

[URL]

So based on his instructions I tried to do my own test, yet I don't get the same result, that is, the bytes are not reversed for me once we rebuild the index by REVERSE key word.

I'm going to write down here the test that I did, where is/are my error(s)

Test Case:
(I use a copy of the employees table in hr sample schema)
SQL> CREATE TABLE emp_test AS SELECT * FROM hr.employees;
Table created.
SQL> CREATE INDEX emp_test_idx ON emp_test(first_name);

[code]...

Now, a test SQL Query using the index we've just defined (just for giving an example)

SQL> SELECT first_name,
2 dump(first_name, 16) as dump_result
3 FROM emp_test
4 WHERE first_name = 'Kelly';

FIRST_NAME DUMP_RESULT
-------------- ----------------------------------
Kelly Typ=1 Len=5: 4b,65,6c,6c,79

[code]...

So, according to the above Execution plan, Oracle does an Index Range Scan using the index that I defined on my table that is, emp_test_idx. According to the output of dump, the key (first_name) in that index is stored (in terms of bytes) as 4b,65,6c,6c,79

SQL> SELECT chr(to_number('4b', 'xx')) ||
2 chr(to_number('65', 'xx')) ||
3 chr(to_number('6c', 'xx')) ||
4 chr(to_number('6c', 'xx')) ||
5 chr(to_number('79', 'xx')) first_name
6 FROM DUAL;

FIRST_NAME
--------------------
Kelly

Which as we can see corresponds to the first name 'Kelly', the first name we specified in the above SQL query.

Now let's rebuild the index

SQL> ALTER INDEX emp_test_idx REBUILD REVERSE;
Index altered.
SQL>

Once the index keys have been reversed, I run the very same query in order to see the difference

SQL> SELECT first_name,
2 dump(first_name, 16) as dump_result
3 FROM emp_test
4 WHERE first_name = 'Kelly';

[code]...

So the second time after the index has been reversed, I still get the very same sequence of bytes, that is, 4b,65,6c,6c,79, whereas I expected to get 79,6c,6c,65,4b (that is, the reversed order of the initial bytes sequence)

View 8 Replies View Related

SQL & PL/SQL :: Using INSTR In Where Clause To Give COMPLETE MATCH Strings?

Dec 9, 2011

We have a SSRS Front end screen which sends multi-select column values as comma separated strings to back end ( Oracle 10g) procedure .

The procedure builds the string by inserting single quotes in the following manner.

P_BU_LST is the parameter which have comma separated values

'1234,3456,4577' i.e, BU ids selected by user in front end
the procedure inserts single quotes to this paramer value

i.e., '1234','3456','4577
v_bu_lst := '''' || REPLACE(v_selbu, ',', ''',''')|| '''';

This is used the where clause of the REF CURSOR SELECT query which send the data back to SSRS

ie.,
SELECT BU.*
FROM BU_DETAIL BU
WHERE INSTR(V_BU_LST,BU_ID) <> 0;

INSTR has a chance to fail in this scenario if the value send from the front end is 123456,3456,4577

here 123456 does not exist in table, but it will be true for INSTR and values 1234 from table will be send back to SSRS which is wrong. Earlier I was using a function to convert the comma separated values to multi-rows and treat it like a lookup table.

But the main table has around million records , and each row has to processed against each row of lookup table, which makes it slower. To avoid this I used INSTR which is faster but can give wrong results.

View 8 Replies View Related

SQL & PL/SQL :: Function In Oracle To Select Not-null Columns At Beginning And Null Columns At End?

Jul 12, 2012

I have 8 columns. Some of them might be null.I want to display all 8 columns in my result. Not null columns will be first and null at the end.Here is a sample data :

Employee table :
Employee_id Emp_fname emp_lname emp_mname dept salary emp_height emp_weight
1 aaa ddd d1 100 6 180
2 bbb ccc 120 169
3 dfe d2 5.9 223

The expected result is :
result1 result2 result3 result4 result5 result6 result7 result8
1 aaa ddd d1 100 6 180
2 bbb ccc 120 169
3 dfe d2 5.9 223

View 8 Replies View Related

ORA-02085 - Database Link String Connects To String

Jun 19, 2012

I have this error (and solution):

ORA-02085: database link string connects to string

Cause: a database link connected to a database with a different name. The connection is rejected.

Action: create a database link with the same name as the database it connects to, or set global_names=false.
Where should I set global_names=false ?

View 7 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







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