SQL & PL/SQL :: Separate String Using REGEXP_SUBSTR
Jan 25, 2011
I can separate numbers from string (info) and the first value of the string using REGEXP_SUBSTR (see below):
with dat as (select '35263304 Alcatel One Touch 806' info from dual)
select info, REGEXP_SUBSTR ( info, '[[:digit:]]+',1 ) tac,
REGEXP_SUBSTR ( info, '[[:alpha:]]+',1) brand
from dat
But how can I get rest of the values from that string (red color) ?
I just would like to get separately like:
35263304 Alcatel One Touch 806
View 5 Replies
ADVERTISEMENT
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
Apr 29, 2011
In my table i have a field called swistmsg, which contains value as
:201:0001OTT11000004|:23b1:CRED|:32a1:01-01-2011|:32a2:USD|:
32a3:1000.|:33b1:USD(similarly around 100 rows)
and my requirement is
201 0001OTT11000004 23b1 CRED 32a1 01-01-2011 32a2 USD 32a3 1000 33b1 USD
and i have eliminate '.',':'&'|' (only quoted chars)from the string separate string
View 17 Replies
View Related
Oct 28, 2013
This I want TO separate TO different COLUMNS based ON comma.
THE RULE IS LIKE out OF total five fields FIRST 3 comma will be FIRST 3 addresses AND rest will be address4 AND LAST NUMBER should appear IN pincode field IF found.
The trouble is for reading reverse to get the number.
WITH address AS (SELECT 'Avenue Supermarts Pvt Ltd,Anjaneya, Opp Hiranandani Foundation School, Powai, Mumbai,Pin Code 400076' addr1 FROM dual UNION ALL
SELECT 'Plot No. J-I, Block B-I, Mohan Co-operative Industrial Area, Mathura Road, New Delhi-110044' addr1 FROM dual UNION ALL
SELECT 'Padmashree Arcade, NH 5, Chinagantiyda Main Road, Gajuwaka, Vishakhapatnam' addr1 FROM dual UNION ALL
SELECT 'The Icon, 2nd 3rd Floor, #8, 80 Feet Road, HAL III Stage, Indiranagar, Banglore-560075' addr1 FROM dual UNION ALL
SELECT '13/1, International Airport Road, Bettahalasur Post, Bengaluru-562157' addr1 FROM dual)
SELECT addr1 FROM address;
View 10 Replies
View Related
Oct 22, 2013
I have some strings like
'Net Amount Payable by an Individual',
'Net Amount Payable by an Individual+Tax',
'Total Amount Payable towards Service',
'Total Amount Payable towards Service.+Tax'
I need to extract the first three letters from each word and separate them using an underscore. The output should be as follows for the above strings -
Net_Amo_Pay_by_an_Ind
Net_Amo_Pay_by_an_Ind_Tax
Tot_Amo_Pay_tow_Ser
Tot_Amo_Pay_tow_Ser_Tax
I request to let me know the way to get the ouput as mentioned.
View 4 Replies
View Related
Sep 28, 2010
I got a record in the column:
<li class='tbl-b'>Ram card: Yes, typ: MicroSD, max. 16 GB </li>
And I would like to extract just:
Ram card: Yes, typ: MicroSD, max. 16 GB
Without <li class='tbl-b'> and </li>.
I try to do this by REGEXP_SUBSTR but not successfully.
View 8 Replies
View Related
Feb 2, 2011
My Database is in Oracle 11g.
My query returns the 3rd field from a CSV string. If the third field in the string is empty I want the select to return a null but it returns the 4th field :
SELECT REGEXP_SUBSTR( 'A,B,,D,E','[^,]+',1,3) from dual;
.. this returns 'D'.
Can we somehow make the REGEX_SUBSTR return a NULL for the third field ?
View 10 Replies
View Related
Oct 27, 2011
I'm trying to get this down from two regexp to a single one, but I'm not sure it can be done and if so, its beyond me to work out how atm.
BANNER
--------------------------------------------------------------------------------
Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - 64bit Production
PL/SQL Release 11.1.0.7.0 - Production
CORE 11.1.0.7.0 Production
TNS for Solaris: Version 11.1.0.7.0 - Production
NLSRTL Version 11.1.0.7.0 - Production
[code]...
The expression itself contains all the rules I'm aware of (nothing to say they won't move the goalposts again mind!) of and the desired output is as shown above. I should add that the actual data is more complex (many tags per record) so it rules out a regexp_replace
View 5 Replies
View Related
Oct 1, 2013
I'm trying to query an array where we will have mathnames that have the follow format: variablemathname[00000]
have been digging around for a few days to try and simplify my existing query. As of right now i'm hacking it together to bring back the bracketed array value by using INSTR and SUBSTR. This works and gets me the correct results but I want to clean the code up by using regexp_SUBSTR.
In my reading up on regular expression I've tried to create my pattern by using [.] which I believe to be [any character]. I want it to start at the beginning of the string so I've used [^ and I only want the one occurrence so I've ended my expression with ]
I tried using the escape before my pattern as I know that [ is a metacharacter but I receive the same results.i'm trying to use to get the expression correct.
SELECT REGEXP_SUBSTR('variablemathname[00000]', '[.],[^,],') RESULT
FROM DUAL;
My expectation is it will bring back the following [00000] but the way it is written now is bringing back nothing.
View 10 Replies
View Related
Jan 26, 2011
I am using embedded sql in a Fortran program on IBM AIX. Whenever I execute a SQL statement other than connect I get a coredump. So I wrote a small test program, but same thing happens. This is the test program -
PROGRAM TEST
EXEC BEGIN DECLARE SECTION
CHARACTER*20 UDPWD
EXEC END DECLARE SECTION
[code]....
And then when I run test, I see the 'Connected' print & then coredump. Same thing happens for EXEC SQL Prepare statement. Am I not linking some library ?
View 22 Replies
View Related
Sep 13, 2012
I am using regexp_substr to break the pipe delimited string. Want to use the output as the NUMBER input to a cursor.Its not working and not getting any error also.
Here is an example.
initial input : '5545|4124|12456'
using the sql below to break the string into columns.
select regexp_substr('5545|4124|12456','[^|]+', 1, level)) from dual
connect by regexp_substr(, '[^|]+', 1, level) is not null;
But when i try to pass the output of the above query to a cursor with input defined as number, its not accepting. I tried using to_number for the output of above query.
View 12 Replies
View Related
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
Nov 6, 2012
create table nov06(
f_name varchar2(20),
l_name varchar2(50),
m_name varchar2(10)
)
insert into nov06 (l_name) values (aaa,bbb);
insert into nov06 (l_name) values (ddd,nnn,jr);
insert into nov06 (l_name) values (fff,mmm);
here the values in the l_name are seperated by ','.
comma seperated values represents "f_name,l_name,m_name".
I've to seperate the strings and put in their respective fields.
Quote:
e.g in second insert statement value (ddd,nnn,jr), so the values will be
f_name -> ddd
l_name -> nnn
m_name -> jr
how can I do it???
View 2 Replies
View Related
Nov 1, 2012
I have a question with Oracle sql developer, i've installed oracle 11g express edition, and i want to insert values 'date' and 'time', but i only got the resultat like this:
Who can tell me how can i do to show just date info in 'date' and same for the 'time'?
View 7 Replies
View Related
Mar 21, 2012
I would like to implement Oracle RAC with 2 nodes for SE Licence. I did a lot when both this nodes with 3 NICs each were plugged at the same switch. Now I have a need to construct a RAC when two nodes will be in separate locations, abot 4 miles from each one. What should I explain to our network administrator he needs to do to implement this solution? I've been told that they can do a FO channel to each location. But don't have exact clear explicaton.
View 3 Replies
View Related
Apr 14, 2013
How to saperate inndexes and tables in two different tablespcae.......???
View 2 Replies
View Related
Dec 18, 2011
I have a multiple forms application and I use OPEN_FORM to call one form from another. However I want the new form to open in a separate tab ( the way it works in a tabbed canvas).
View 4 Replies
View Related
Jul 26, 2011
Let's say I have this table:
create table TEST
(
CF VARCHAR2(16),
START_DATE DATE,
END_DATE DATE
)
with
insert into test (CF, START_DATE, END_DATE)
values ('ME', to_date('01-01-2011', 'dd-mm-yyyy'), to_date('31-12-2010', 'dd-mm-yyyy'));
I need make a select where I get n rows, where n is the number of trimesters that compose the date interval in the table. Each of the returned rows must have as start_date/end_date the boundaries of that trimester.(ALL start dates are the first day of a month, and all end dates are the last day of a month)
In this case I need to get:
ME - 01/01/2010 - 31/03/2010
ME - 01/04/2010 - 30/06/2010
ME - 01/07/2010 - 30/09/2010
ME - 01/10/2010 - 31/12/2010
View 9 Replies
View Related
May 14, 2013
I wrote an query and regarding one part, i have syntax problem, when should we seperate different arithmetic operators in a query?
for example
select density_with_desert.popp / density_with_desert.arr - sum(darea) from counytyi don't want to use variables.
View 8 Replies
View Related
Mar 17, 2011
We are using oracle forms 10g, in formsweb.cfg file i gave separeteFrame=true and it works fine also like IE & applet window is opening. But User wants to hide the IE in backegroud and they want only applet window, so using VBScript we are hiding the IE and now only applet window apears this also fine.
I am running the report and displaying the report using web.show_document, report is running fine and displaying in IE with PDF format. But the problem is if i press the run report button report is opening and displaying behind the applet window not infront of applet window and there is no focus on the report IE also. How to display the report output(IE with PDF format) infront of the applet window and current focus on the report window(IE with PDF).
Note: If i use separateFrame=false then report is displaying infront of the IE screen and focus is on the report IE.
View 1 Replies
View Related
Apr 29, 2013
I have some .fmb files in 'F: ask" " ' location.and my question is can i store the .Fmx files in other location like 'D:" " '
that is if i create a .fmx file for the 'F: ask**.fmb'. i want That .fmx file will store into other location i.e 'D '
View 3 Replies
View Related
Jul 19, 2008
I am simply trying to execute a couple of select statements in a single dynamic query. I also want it to return a seperate result set from each statement (something quite easy in T-SQL - but seemingly impossible in PL-SQL!)
This query is being run from C#, but i also get the same results from Sql Developer.This is what i'm trying to execute:
begin
select * from studies;
select * from studyprogressions;
end;
The error i get is "an INTO clause is expected in this SELECT statement" for each of the select lines - As you may already have worked out - I don't use Oracle very often and am starting to feel very stupid considering i have certifications in SQL Server/T-SQL!
I have searched online for a solution, but it seems that everyone with the same error is trying to do so much more.Why is nothing in Oracle simple? Give me SQL Server any day of the week.
View 14 Replies
View Related
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
Mar 1, 2010
I have table called Orders with lots of fields from Imports Fields are ConsigneeKey,Shipto,ProductCode. and another table called Product. Main fields are ProductCode,Price,Weight,StdCube. Now I have two list of Consineekey,One which is shipto X area and another is of Y area. I want to make query like separate list of Orders which is shipto X,Y and Common Products in Both X and Y. I will supply list of Consigneekey in where clause.
View 8 Replies
View Related
Sep 25, 2013
Version: 11.2.0.3Platform : Solaris 10
One of the Hitachi support guy has suggested to create a separate disk group for Online redo logs. His rationale was that ORLs was write only files and it would be better to put in a separate disk group.
View 6 Replies
View Related
Aug 17, 2010
Need pl/sql block to fetch all the emails of all the employees from the database and separate them by semicolon....
View 4 Replies
View Related
Nov 10, 2013
archive logs to be stored in its own "date formatted" separate folders.I have already configured flashrecovery area and I dont want to change it as backups are stored there.How can I achieve this without changing the flash recovery area location ? db_recovery_file_dest is set to G:log archive dest is set to F
View 8 Replies
View Related
Oct 31, 2006
I have data that i am sorting, the data is mostly numeric (format of XXX-1234). is there any way to have my query sort xxx-1000 AFTER xxx-999? right now i am thinking i will have to create a separate sort order column on my table.
View 2 Replies
View Related
May 25, 2011
As we know that date datatype can store both date part and time part. If I specify the Date format for my database as 'DD-MM-YYYY HH@$:MI:SS' can i ensure i anyways for a particular columns in the database containing date values the format is 'DD-MM-YYYY' i.e without the time part.Can we specify seperate date formats for specific columsn in database during table creation?
View 1 Replies
View Related
May 8, 2012
I want to capture date and time in separate fields from user and save it in single column in table
example: user enters date and time
Date : 08/05/20212
Time : 18:50:00
At the time of save I want to save [08/05/2012 18:50:00].
View 1 Replies
View Related