Query Help... INSTR/SUBSTR/SUBSTR_REGEXTRACT
basically, I am trying to convert timezone of my incoming record from UTC to local timezone of the record. Essentially, I am going to do this from a lookup table that contains all the UTC conversions to local timezone.
so, if I have 3 possible patterns of of records:
(GMT-05:00) Eastern Time (US & Canada)
(GMT+02:00) Harare, Pretoria
(GMT) Greenwich Mean Time : Dublin, Edinburgh, Lisbon, London
and I want to get the numeric value (if available else 0)
so for the first record I would want -5
for the second recodr I want 2
for the third record I want 0
from my select query. how would I do that? ne ideas...with SQL query if possible..the DB is Oracle..
ne suggestions?
Or
SQL> with t as (
select '(GMT-05:00) Eastern Time (US & Canada)' time_z from dual union
select '(GMT+02:00) Harare, Pretoria' from dual union
select '(GMT) Greenwich Mean Time : Dublin, Edinburgh, Lisbon, London' from dual
select time_z, nvl(to_number(regexp_substr(time_z, '[+-]\d+')),0) diff
from t
TIME_Z DIFF
(GMT) Greenwich Mean Time : Dublin, Edinburgh, Lisbon, London 0
(GMT+02:00) Harare, Pretoria 2
(GMT-05:00) Eastern Time (US & Canada) -5
3 rows selected.
Similar Messages
-
i have a problem in writing a query.
It is a simple select having a "IN" clause, the values of which are created dynamically.
Now since the IN clause could exceed 1000 values at a time, im using it as shown below
select * from table where (col1 in () or in () or in()....);
but my problem is that Im unable to set limit for values inside the IN clause.The values in the IN clause are in format ' %' i.e they are quoted and have a varaible length which Im trying to retrieve either thru INSTR or through SUBSTR.
I get these dynamic values in a varaible.Then i have to select the values for the IN clause from this variable.
Kindly help...its urgentWhy bother with instr/substr and the limitation of the IN clause?
Try to generate a select statement out of your csv format (lots of examples out there). One way could be:
SQL> var str varchar2(100)
SQL> var cur refcursor
SQL> exec :str := 'scott,james'
PL/SQL procedure successfully completed.
SQL> begin
open :cur for
select empno, ename from emp
where ename in (
select upper (t.column_value.extract ('//text()'))
from table(cast(xmlsequence(xmltype ('<d><d>'|| replace (:str, ',', '</d><d>') || '</d></d>').extract ('d/d')) as sys.xmlsequencetype)) t);
end;
PL/SQL procedure successfully completed.
SQL> print cur
EMPNO ENAME
7788 SCOTT
7900 JAMES -
Query Help:
http://forum.java.sun.com/thread.jsp?forum=45&thread=471180&tstart=15&trange=15
It seems I have confused enough people with my improper presentation of query. Sorry guys. I will restate my question with different table names.
The above was my previous posting, which was not clear..so Iam restating my problem as follows....
I have the following tables
Customer(custID, Name, Address)
Order(custID, OrderID, orderDate)
CreditCard(custID, creditCard#, creditCardType)
Now if I have 3 records in Order with custID 100 and 2 records in CreditCard as
Order:
100,A001,11/22/03
100,A002,11/24/03
100,A003,12/02/03
CreditCard:
100,42323232..., VISA
100,5234234...., MASTER
Now how can I get
custID, Name, Address, OrderID, orderDate, creditCard#, creditCarType
data in minimum no. of records....
I think I have made my query clear..
now please help me guys...
thanks so much for your help.You are right.
But frankly the actual tables on my database are not customer,orders and creditcards..but I just tried to reproduce the problem with these tables, please ignore that user needs a refund etc situtaion. If the tables were actually order,creditcards etc..it would have been a problem to be considered.
Can you please help me with the query
if I have m rows in Order and n rows in CreditCard. I will get m*n records, I looking for max(m,n).
With the following fields in my query result,
custID, Name, Address, OrderID, orderDate, creditCard#, creditCarType
from Customer, Order, CreditCard tables
Thanks so much for your htlp -
SQL Query Help - Is this possible or impossible????
Hi guys,
I need help with an SQL query that I'm trying to develop. It's very easy to explain but when trying to implement it, I'm struggling to achieve the results that I want.....
For example,
I have 2 tables
The first table is:
1) COMPANY create table company (manufacturer varchar2(25),
date_established date,
location varchar2(25) );My sample test date is:
insert into company values ('Ford', 1902, 'USA');
insert into company values ('BMW', 1910, 'Germany');
insert into company values ('Tata', 1922, 'India');The second table is:
2) MODELS create table models (manufacturer varchar(25),
model varchar2(25),
price number(10),
year date,
current_production_status varchar2(1) ) ;My sample test data is:
insert into models values ('Ford', 'Mondeo', 10000, 2010, 0);
insert into models values ('Ford', 'Galaxy', 12000, 2008, 0);
insert into models values ('Ford', 'Escort', 10000, 1992, 1);
insert into models values ('BMW', '318', 17500, 2010, 0);
insert into models values ('BMW', '535d', 32000, 2006, 0);
insert into models values ('BMW', 'Z4', 10000, 1992, 0);
insert into models values ('Tata', 'Safari', 4000, 1999, 0);
insert into models values ('Tata', 'Sumo', 5500, 1996, 1);
insert into models values ('Tata', 'Maruti', 3500, 1998, 0);And this is my query:
SELECT
com.manufacturer,
com.date_established,
com.location,
DECODE(nvl(mod.current_production_status, '0'), '0', '-', mod.model),
DECODE(nvl(mod.current_production_status, '0'), '0', '-', mod.price),
DECODE(nvl(mod.current_production_status, '0'), '0', '-', mod.year),
mod.current_production_status
FROM
company com,
models mod
WHERE
mod.manufacturer = com.manufacturer
and com.manufacturer IN ('Ford', 'BMW', 'Tata')
and mod.current_production_status IN (1,0)
ORDER BY
mod.current_production_status DESCWhat I want the query to output is this:
com.manufacturer com.date_established com.location mod.model mod.price mod.year mod.current_production_status
Ford 1902 USA Escort 10000 1992 1
BMW 1910 Germany - - - 0
Tata 1922 India Sumo 5500 1998 1If current_production_status is 1 it means this particular model has been discontinued
If current_production_status is 0 it means the manufacturer does not have any discontinued models and all are in procuction.
The rule is only one record per manufacturer is allowed to have a current_production_status of 1 (so only one model from the selection the manufactuer offers is allowed to be discontinued).
So the query should output the one row where current_production_status is 1 for each manufacturer.
If for a given manufacturer there are no discontinued models and all have a current_production_status of 0 then ouput a SINGLE row that only includes the data from the COMPANY table (as above). The rest of the columns from the MODELS table should be populated with a '-' (hyphen).
My query as it is above will output all the records where current status is 1 or 0 like this
com.manufacturer com.date_established com.location mod.model mod.price mod.year mod.current_production_status
Ford 1902 USA Escort 10000 1992 1
Tata 1922 India Sumo 5500 1998 1
Ford 1902 USA - - - 0
Ford 1902 USA - - - 0
BMW 1910 Germany - - - 0
BMW 1910 Germany - - - 0
BMW 1910 Germany - - - 0
Tata 1922 India - - - 0
Tata 1922 India - - - 0However this is not what I want.
Any ideas how I can achieve the result I need?
Thanks!
P.S. Database version is '10.2.0.1.0'Hi Vishnu,
Karthiks query helped...
But this is the problem I am facing...
SELECT
com.manufacturer,
com.date_established,
com.location,
DECODE(nvl(mod.current_production_status, '0'), '0', '-', mod.model),
DECODE(nvl(mod.current_production_status, '0'), '0', '-', mod.price),
DECODE(nvl(mod.current_production_status, '0'), '0', '-', mod.year),
mod.current_production_status
FROM
company com,
models mod
WHERE
mod.manufacturer = com.manufacturer
and com.manufacturer = 'Ford'
and mod.current_production_status IN (1,0)
ORDER BY
mod.current_production_status DESCThe value of:
and com.manufacturer = 'Ford'will be dependent on front end user input....
When I run the query above I get all the rows where current_production_status is either 1 or 0.
I only require the rows where current_production_status is 1.
So if I amend it to look like this:
and mod.current_production_status = 1This works....
BUT if a user now passes in more than one manufacturer EG:
and com.manufacturer IN ('Ford', 'BMW')The query will only return the one row for Ford where current_production_status is 1. However because BMW has no models where current_production_status is 1 (all 3 are 0), I still want this to be output - as one row....
So like this:
com.manufacturer com.date_established com.location mod.model mod.price mod.year mod.current_production_status
Ford 1902 USA Escort 10000 1992 1
BMW 1910 Germany - - - 0So (hopefully you understand), I want both cases to be catered for.....whether a user enters one manufacturer or more than one...
Thanks you so much!
This is really driving me insane :-( -
hii
i need a query help
i have two tables
the 1st table will look like this
associate id weekid no.of. hours
4000 810 40
4000 820 30
4000 830 60
4000 840 70
2nd table will look like this
associate id weekid no.of.hours
4000 810 40
4000 820 70
4000 830 130
4000 840 200
so when i subtract the last two records frm each other in the second table the value should be equal to the no.of.hours in the first table.. for example
the query shud consider the last record and one before the last record and the difference between two records shud be equal to the value in the 1st table
for example
consider week id 830 and 840
in second table 830=130
840=200
when u subtraced both values the difference shud be equal to value in the 1st table for tht week id
1 ---->>>> 840 - 830
=200 - 130
=70
in first table 840 has 70 hrs
like this it shud check with all records and it shud return only the records which are not equal
regards
srikanthThis..?
sql>select * from t1;
A_ID W_ID HRS
4000 810 40
4000 820 30
4000 830 60
4000 840 70
4000 850 80
sql>select * from t2;
A_ID W_ID HRS
4000 810 40
4000 820 70
4000 830 130
4000 840 200
4000 850 260
sql>
select a_id,w_id,hrs,sum_hrs
from(
select t1.a_id a_id,t1.w_id w_id,t1.hrs hrs,t2.hrs sum_hrs,
t2.hrs - nvl(lag(t2.hrs) over(order by t1.w_id),0) diff
from t1,t2
where t1.w_id = t2.w_id)
where diff != hrs;
A_ID W_ID HRS SUM_HRS
4000 850 80 260 -
Urgent: Need Help with Substring/Instring
I am taking a user input P_User_Name.
P_User_Name is firstname/middlename/lastname
Some examples:
'James/Earl/Jones'
'//Madonna'
'Alec//Baldwin'
Can someone tell me the code in PL/SQL to extract first name, middlename, lastname for a given P_User_Name.
I would really appreciate your help.
Thanks
Home722Duplicate/triplicate posting... pathetic!!
Urgent: SQL Gurus: Please Help
Substring -
Query help to find missing rows
Hi,
Create tableA (
columname varchar2;
Insert into tableA ('a3');
Insert into tableA ('dd');
Select * from tablename where column in ( a3, b12,c34, dd ); -- 4 Values provided
Need a query to return b12,c34 ie I have to find which records or not returning from a table for a given values.
Please help
Thanks
Arvy
Edited by: ARVY on Jun 19, 2012 11:10 AM
Edited by: ARVY on Jun 19, 2012 11:16 AMARVY wrote:
I am using Oracle 9i versionFollowing is query that should be compatible on 9i.
Please test it,since I am not able to do it due to unavailability of Oracle 9i with me.
with data as
select 'a,b,c,d' || ',' col from dual
isolated_data as
select trim(both ',' from (substr(col,
DECODE(level,
1, 1,
instr(col, ',', 1, level - 1) + 1
DECODE(level,
1, instr(col, ',', 1, level),
instr(col, ',', 1, level) - instr(col, ',', 1, level - 1)
) ))col1
from data
connect by level <= length(col) - length(replace(col, ','))
select a.col1
from isolated_data a
where a.col1 NOT IN (select col from test_Table);Regards,
P. -
Query help in regular expression
Hi all,
SELECT * FROM emp11
WHERE INSTR(ENAME,'A',1,2) >0;
Please let me know the equivalent query using regular expressions.
i have tried this after going through oracle regular expressions documentation.
SELECT * FROM emp11
WHERE regexp_LIKE(ename,'A{2}')
Any help in this regard would be highly appreciated .
Thanks,
P Prakashplease go here
Introduction to regular expressions ...
Thanks,
P Prakash -
Query help, Percentages / ratio to reports / nests
Hi
I have a query that returns data like this
D_NO POINTS COUNT_POINTS ID_COUNT
4002 L_T_69 12 282
4219 L_T_69 1 151
4228 L_T_69 18 193
4229 L_T_69 7 181
4230 L_T_69 0 197
I need to also output a column that works out a percentage of count_points and Id_count. e.g 12/282 * 100 = 4.2
I had a try with ratio to reports function but no joy for me. I think i need to add in
another nested select or something but what i was trying wasnt working.
Can anyone help.
here is the query so far
SELECT D_NO,
GROUPS.POINTS,
DECODE(GROUPS.POINTS, 'L_T_69' , L_T_69) AS COUNT_POINTS,
ID_COUNT
FROM
(SELECT D_NO,
Count (CASE WHEN VERBAL <= 69 THEN 1
END) AS L_T_69,
COUNT(ID_NUMBER) AS ID_COUNT
FROM TBL_1
WHERE VERBAL IS NOT NULL
group by D_NO)
TBL_1,
( SELECT 'L_T_69' POINTS FROM DUAL )GROUPS
thank youNot sure if this is what you're looking for but it may give you some clues:
select object_type
,has_a_c
,type_total
,round(100 * (has_a_c / type_total),2) ratio
from
select object_type
,sum (case when instr(object_name,'C') <> 0 then 1
else 0
end) has_a_c
,count(*) type_total
from all_objects
group by object_type
OBJECT_TYPE HAS_A_C TYPE_TOTAL RATIO
CONSUMER GROUP 1 2 50
EVALUATION CONTEXT 1 1 100
FUNCTION 50 113 44.25
INDEX 7 20 35
LIBRARY 0 2 0
OPERATOR 1 2 50
PACKAGE 500 1158 43.18
PACKAGE BODY 487 1126 43.25
PROCEDURE 54 86 62.79
SEQUENCE 62 116 53.45
SYNONYM 1060 2298 46.13
TABLE 365 721 50.62
TABLE PARTITION 15 15 100
TYPE 104 272 38.24
VIEW 834 1896 43.99
15 rows selected. -
Please help me : SUBSTR function in Oracle 6i
Dear all people!
I have a problem with SUBSTR as follow:
my code:
declare
string1 varchar2(300);
string2 varchar2(65);
begin
string1 := ....
string2 := substr(string1,1,60);
end;
when i run program in debug
at command "string2 := substr(string1,1,60);" it raise error ORA-06502;
Please tell me how to assign substr(string1,1,60) to string2 (max length of string2 is 65);
I'm looking to forward to receiving your response!
Thank you very much;The question was simple:
I am trying to do is bring in anything after the * in the Id column no matter how long the name is before the * but my calculation is way off L:
Here is an example of what my data would look like but what I need it to do:
Id NEW COLUMN
TNET*231333 231333
AMER*29283893.2 29283893.2
TNEY*21893838 21893838
Do you know how to create this calculation?
Answer: SUBSTR(id,INSTR(id,'*',1)+1,999)
this was emailed to me from someone on here saying "try to see if this helps" and it did that's why i said thank you. -
hi friends,
my query is like below.
select SUBSTRING('one thousand one hundread one reuppee only asasasas aaaaa bbbbb',1,60)
and my output of above query is below..
'one thousand one hundread one reuppee only asasasas aaaaa bb'
but i want display only up to 'one thousand one hundread one reuppee only asasasas aaaaa'
because my bbbbb it not complete so i want to find the space before 'bbbbb' and diplay up to 'aaaaa'One way, if looking for the first space from the right is also fine:
SQL> -- generating sample string
SQL> with t as (
2 select 'one thousand one hundread one reuppee only asasasas aaaaa bbbbb' str from dual
3 )
4 --
5 -- actual query:
6 --
7 select substr( str
8 , 1
9 , instr( str, chr(32), -1, 1)-1
10 )
11 from t;
SUBSTR(STR,1,INSTR(STR,CHR(32),-1,1)-1)
one thousand one hundread one reuppee only asasasas aaaaa
1 row selected -
Please help solve this question i am stuck on
We have the following value that we can use:
Numeric: 0-34 and 80-100 only
or Non Numberic X S U D- D D+
Have to use INSTR and SUBSTR functions to test that the value is a valid
(for now only trying to create a function which can later be put into a procedure.)
SELECT TO_NUMBER('12 ') //e.g HERE 12 and a space for the values as above
FROM DUAL
the where clause looks at all three spaces to make sure values are correct (given number or non-numberic values only)
(Hence if the number is true then number comes back (meaning true)
or it says NO rows)
If value is non numeric, test it to allow non numberic also.
I am completely unsure about it but tried this
SELECT TO_NUMBER('34 ')
FROM DUAL
WHERE INSTR('0123456789',1,1)<=9 (looking at first number ?)
AND
INSTR('0123456789',2,2)<=9
AND
INSTR('0123456789',3,3)=0;
Something like this has to be done.....subst (instr, x,x,) i think mite help.Why not use regular expressions? The below thread gives you an example and instructions on how to use.
alphanumeric validation -
I have to do a task of finding records which matches the following logic.
My table has PID varchar(15), Amount varchar (50),Status varchar(20) columns.
Each PID can go thru changes in a period of time, in my case i dont have a data range I just have a flatfile which consists of three types of PID`s
123456 = Original_PID, Reversal =123456R1,Adjustment= 123456A1.
Basically What I am trying to find out if there are any original PID`s which has a Reversal or an Adjustment.
here`s the code I have started on... Can someone help me get it finished?
select R1. pid,a1.pid,org.pid from (
select SUBSTRING(Pid,1,11)as Original_PID, status, paid_amount as Amount from dbo.Q2STATUS)org
inner join (select SUBSTRING(Pid,1,13)as Original_Icn,status,paid_amount from dbo.Q2STATUS
where SUBSTRING(Pid,12,2) ='R1')r1 on r1.pid=org.pid
inner join (select SUBSTRING(claim_id,1,13)as Original_Icn,status,paid_amount from dbo.Q2STATUS
where SUBSTRING(Pid,12,2) ='A1')A1 on a1.Pid=org.PID
FMHi,
Please check following item
It uses a
SQL string function, please create it first
create table Q2STATUS (Pid nvarchar(200), Status varchar(20), paid_amount int)
insert into Q2STATUS select '123456 = Original_PID, Reversal =123456R1, Adjustment= 123456A1',NULL,250
with cte2 as (
select rn = row_number() over (order by pid), * from Q2STATUS
), cte as (
select cte2.*, s.id typeid, v.*
from cte2
cross apply dbo.split(cte2.Pid, ',') s
cross apply dbo.split(s.val, '=') v
), cte3 as (
select
rn, pid, status, paid_amount, max(pidtype) pidtype, max(pidval) pidval
from (
select
rn, Pid, status, paid_amount, typeid,
case when (typeid = 1 and id = 2) or (typeid <> 1 and id = 1) then ltrim(rtrim(val)) else null end as pidtype,
case when (typeid = 1 and id = 1) or (typeid <> 1 and id = 2) then ltrim(rtrim(val)) else null end as pidval
from cte
) g
group by rn, pid, status, paid_amount, typeid
select
cte2.rn, cte2.pid,
cte3.pidval as 'Original_PID',
cte4.pidval as 'Reversal',
cte5.pidval as 'Adjustment'
from cte2
left join cte3 on cte3.rn = cte2.rn and pidtype = 'Original_PID'
left join cte3 as cte4 on cte4.rn = cte2.rn and cte4.pidtype = 'Reversal'
left join cte3 as cte5 on cte5.rn = cte2.rn and cte5.pidtype = 'Adjustment'
Here is the result,
Please note that I have used
SQL CTE expressions a lot in the SQL query to prevent usage of sub-select and temp tables.
There is also a
SQL ROW_NUMBER() function used in the first SELECT statement to distinquish all items from each other instead of using the PID column value. Perhaps you have already an ID key column, you can use it too
SQL Server, SQL Server 2012 Denali and T-SQL Tutorials -
I have Table
Columns
ID NUMBER1 NUMBER2
1A 20
1A 21
1B 22
1B 23
1C 24
1C 25
I need a Query like below
ID NUMBER1||NUMBER2
1A 20-21
1B 22-23
1C 23-24
Any help is appreciated
ThanksSupposing data below:
SQL> select * from t;
ID NUMBER1 NUMBER2 LOC_NUM
1A 21 200
1A 22 200
1B 23 201
1B 24 201
1C 25 202
1C 26 202
1C 27 202
1C 28 202
8 rows selected.
SQL> select * from t2;
LOC_NUM NAME CODE
200 AAA 2001
201 BBB 3001
202 CCC 4001
SQL> select id, max(substr(sys_connect_by_path(col1,'-'),2))
2 || '-' || max(name) || '-' || max(code) path
3 from (
4 select id,
5 coalesce(number1, number2) col1,
6 row_number() over (partition by id
7 order by coalesce(number1, number2)) rn, t2.name, t2.code
8 from t, t2
9 where t.loc_num = t2.loc_num
10 )
11 start with rn = 1
12 connect by prior rn + 1 = rn and prior id = id
13 group by id
14 /
ID PATH
1A 21-22-AAA-2001
1B 23-24-BBB-3001
1C 25-26-27-28-CCC-4001Rgds. -
Query help for where condition
Hi ,
I have String value in table now I require to check that value is valid or not .
I have below Query .
SELECT *
FROM Table TCI
WHERE (ISDATE(SUBSTRING(SUBSTRING(Data,82,6),1,4)+'-'+SUBSTRING(SUBSTRING(Data,82,6),5,2)+'-'+'01')<>1 OR LEN(LTRIM(RTRIM(SUBSTRING(Data,82,6)))) < 0 OR SUBSTRING(Data,82,6)='000000')
AND (LEN(LTRIM(RTRIM(SUBSTRING(Data,88,6)))) < 0 OR SUBSTRING(Data,88,6)= '000000' OR ISDATE(SUBSTRING(SUBSTRING(Data,88,6),1,4)+'-'+SUBSTRING(SUBSTRING(Data,88,6),5,2)+'-'+'01')<>1)
AND (LEN(LTRIM(RTRIM(SUBSTRING(Data,173,6)))) < 0 OR ISDATE(SUBSTRING(SUBSTRING(Data,173,6),1,4)+'-'+SUBSTRING(SUBSTRING(Data,173,6),5,2)+'-'+'01')<>1)
AND (LEN(LTRIM(RTRIM(SUBSTRING(Data,195,6)))) < 0 OR ISDATE(SUBSTRING(SUBSTRING(Data,195,6),1,4)+'-'+SUBSTRING(SUBSTRING(Data,195,6),5,2)+'-'+'01') <>1)
AND (LEN(LTRIM(RTRIM(SUBSTRING(Data,217,7))))<0 OR ISNUMERIC(LTRIM(RTRIM(SUBSTRING(Data,217,7)))) <> 1)
AND ISNUMERIC(REPLACE(SUBSTRING(Data,334,10),'-','0'))<>1
AND ISNUMERIC(SUBSTRING(Data,345,10))<>1
AND ISNUMERIC( SUBSTRING(Data,355,10))<>1
AND ISNUMERIC(SUBSTRING(Data,416,8))<>1
AND (LEN(LTRIM(RTRIM(SUBSTRING(Data,104,6))))<0 OR ISNUMERIC(SUBSTRING(Data,104,6))<>1)
AND (LEN(LTRIM(RTRIM(SUBSTRING(Data,145,7))))<0 OR ISNUMERIC(SUBSTRING(Data,145,7))<>1)
AND (LEN(LTRIM(RTRIM(SUBSTRING(Data,152,7))))<0 OR ISNUMERIC(SUBSTRING(Data,152,7))<>1)
AND (LEN(LTRIM(RTRIM(SUBSTRING(Data,159,7))))<0 OR ISNUMERIC(SUBSTRING(Data,159,7))<>1)
AND (LEN(LTRIM(RTRIM(SUBSTRING(Data,166,7))))<0 OR ISNUMERIC(SUBSTRING(Data,166,7))<>1)
AND (LEN(LTRIM(RTRIM(SUBSTRING(Data,179,3))))<0 OR ISNUMERIC(SUBSTRING(Data,179,3))<>1)
AND (LEN(LTRIM(RTRIM(SUBSTRING(Data,201,3))))<0 OR ISNUMERIC(SUBSTRING(Data,201,3))<>1)
AND (ISNUMERIC(REPLACE(SUBSTRING(Data,365,10),'-','0'))<>1 OR ISNUMERIC( REPLACE(SUBSTRING(Data,365,10),'-','0'))<>1)
AND (ISNUMERIC(REPLACE(SUBSTRING(Data,375,10),'-','0'))<>1 OR ISNUMERIC( REPLACE(SUBSTRING(Data,375,10),'-','0'))<>1)
AND (ISNUMERIC(REPLACE(SUBSTRING(Data,385,10),'-','0'))<>1 OR ISNUMERIC(REPLACE(SUBSTRING(Data,385,10),'-','0'))<>1)
AND (ISNUMERIC(REPLACE(SUBSTRING(Data,395,10),'-','0'))<>1 OR ISNUMERIC(REPLACE(SUBSTRING(Data,395,10),'-','0'))<>1)
AND (ISNUMERIC(REPLACE(SUBSTRING(Data,405,10),'-','0'))<>1 OR ISNUMERIC(REPLACE(SUBSTRING(Data,405,10),'-','0'))<>1)
I need only invalid record set from below Query ;
like; If it is not isdate and is_numeric type for particular row then it return only that row.
currently i'm facing issue like whole string is invalid in that case it gives row .
should I use case statement in where clause ?
Thanks
Please Mark This As Answer or vote for Helpful Post if this helps you to solve your question/problem. http://techequation.comI need only invalid record set from below Query ;
like; If it is not isdate and is_numeric type for particular row then it return only that row.
currently i'm facing issue like whole string is invalid in that case it gives row .
should I use case statement in where clause ?
Hi PrajapatiNeha,
Your requirement is confusing. Judging from the query, the column data
seems to be a string which consists of fixed length date or numberic format substrings, so you are verifying each substring is valid and need to select the invalid substrings?
If that is your requirement, why not just extract the substrings into a derived table and filter based on the derived table? The substrings in the derived table will give a more directly overview of your long data string.
If you have any question, feel free to let me know.
Eric Zhang
TechNet Community Support
Maybe you are looking for
-
Itunes keeps asking me for a user name and password when I first open it.
I do not allow apple to access my library or my hard drive because you guys are predators, and I have NO interest in using the app store. I have disabled access to the store, so i do not know why it keeps asking me for a user name and password. You
-
Yosemite, Security Settings Does Not Unlock
Hi, I am trying to change my security settings so unapproved software can be also installed. However, when I click on the lock, it does not unlock after I type in my credentials and I am an admin on my computer. Can anyone help with this? By the way,
-
Hi, I recently bought AT200 from Germany. It works well except that I don't know how to connect it to PC for file exchanging. I used Acer tablet before and it worked in a wink. I tried to install all drivers, the MTP USB shows that it fails. My OS is
-
Ask for help on UTL_FILE
How can I tell the value of the UTL_FILE_DIR parameter? I met error like the follow. SQL*Plus screen dump. SQL> DECLARE 2 fl UTL_FILE.FILE_TYPE; 3 in_buffer VARCHAR2(20):= 'Test'; 4 BEGIN 5 fl:=UTL_FILE.FOPEN ('/tmp', 'test.txt', 'w'); 6 dbms_output.
-
Dreamweaver animation speeds up
I have an animation that loops to show some content panes on a home page. Every few seconds a new frames slides in triggered by an action. After a few loops, the animation gradually speeds up until it is so fast the only pause is the time it takes fo