Need a query to find newline characters data( either chr(10) or chr(13))
I have 5 columns in a table and these columns have newline characters data( either chr(10) or chr(13)).
Now I need to fetch data so that all the records which have new line character( either chr(10) or chr(13) ) in any of these 5 columns should be retrieved.
Please help me with a correct query for this task.
Edited by: nav on Jun 2, 2011 10:21 PM
An example .. you can do it for all 5 columns adding "OR" conditions
with t as
(select 'Arun'||chr(10) a, 'Gupta'||chr(13) b from dual union all
select 'Dinesh'||chr(10) a, 'Kumar'||chr(13) b from dual union all
select 'Naresh'||chr(10) a, 'Raja' b from dual union all
select 'Harish' a, 'Mahesh' b from dual union all
select 'Jatin'||CHR(13) a, 'Mahesh' b from dual
select * from t
where a like '%'||CHR(10)
or a like '%'||CHR(13)
or b like '%'||CHR(10)
or b like '%'||CHR(13) Regards
Arun
Similar Messages
-
Newline characters data( either chr(10) or chr(13))
I have 2 columns in a table and these columns have newline characters data( either chr(10) or chr(13)).
Now I need to fetch data so that all the records which have new line character( either chr(10) or chr(13) ) in any of these 2 columns should be retrieved.
create table sri_newchar (name varchar2(100))
insert into sri_newchar values('Sri'||chr(10)||'Ram'||chr(13)||'Kumar')
insert into sri_newchar values('Sri'||chr(13))
insert into sri_newchar values('RajeshMishra')
insert into sri_newchar values('Sri'||chr(10)||'Raj'||chr(13)||'Kapoor')
insert into sri_newchar values('Sri'||chr(13))
insert into sri_newchar values('Vinod'||Chr(10)||'Shimla')
insert into sri_newchar values('Rajkumar'||Chr(10)||'Goyal')
I have return query like
select * from sri_newchar where name like '%'||CHR(10) ||'%'
any other way to write this query
Please help me with a correct query for this task.nav wrote:
Now I need to fetch data so that all the records which have new line character( either chr(10) or chr(13) ) in any of these 2 columns should be retrieved.Try
select * from Sri_Newchar where instr(name,chr(10)) >0 or instr(name,chr(13)) >0Vivek L -
Need MDX query to find something like date diff and Date Range for last 10 days
Hi ,
I need two Query .First Query for below;
I have below data in table like.
Cat StartDate EndDate
A 2000-01-01 2000-01-15
B 2000-01-02 2000-01-30
C 2000-01-01 2000-01-31
D 2000-02-01 2000-02-28
A 2000-01-10 2000-01-31
I need if Startdate and Date completes whole one month then set status =1 else 0 using MDX query.
like this ;
Cat StartDate EndDate Status
A 2000-01-01 2000-01-15 1
B 2000-01-02 2000-01-30 0
C 2000-01-01 2000-01-31 1
D 2000-02-01 2000-02-28 1
A 2000-01-10 2000-01-31 1
In second query I need last 10 days from current days like;
Now = 8/20/2014
output will be ;
8/20/2014
8/19/2014
8/18/2014
8/17/2014
8/16/2014
8/15/2014
8/14/2014
8/13/2014
8/12/2014
8/11/2014
8/10/2014
Please help me .
ThanksHi Prajapati,
In your scenario, you can use Properties and Datediff function to achieve your requirement. Since not know the structure of your cube, we cannot give you the esact query.
I have tested it on the AdventureWorks cube, the query below is for you reference.
WITH MEMBER [Measures].[StartDate]
AS
[Employee].[Employee Department].CURRENTMEMBER.PROPERTIES('Start Date')
MEMBER [Measures].[WorkYear]
AS
DATEDIFF('yyyy',[Measures].[StartDate],NOW())
MEMBER [Measures].[Status]
AS
IIF(DATEDIFF('yyyy',[Measures].[StartDate],NOW())>10,1,0)
SELECT {[Measures].[StartDate],[Measures].[WorkYear],[Measures].[Status]} ON 0,
[Employee].[Employee Department].[Employee].MEMBERS ON 1
FROM [Adventure Works]
Results
Reference
http://msdn.microsoft.com/en-us/library/ms144821.aspx
Regards,
Charlie Liao
TechNet Community Support -
Looking for a query to find first/last dates in overlapping dates...
Hi,
I'm looking for a query to find the first dates and last dates in a table conaining overlapping dates.
I have a subscription table which has for each Customer start and end date for different subscriptions.
I want to know the different ranges of date where there is subscriptions active.
so if the table has this:
CustID, Start date, end date
1, 2008-01-01, 2012-06-06
1 ,2009-01-01, 2011-01-01
1, 2011-01-01, 2013-02-02
1, 2013-01-01, 2013-08-08
1, 2014-01-01, 2014-04-04
I want to produce this result:
custid, range start, range end
1, 2008-01-01, 2013-08-08
1, 2014-01-01, 2014-04-04
the first row is the range identified from the 4 rows in my subscription table.
thanks :)I think I found it...
http://stackoverflow.com/questions/5213484/eliminate-and-reduce-overlapping-date-ranges
let me try this method
Hi,
m writing to follow up with you on this post. Thanks for you posting a reply to share your workground. Was the problem resolved after performing the above link? If you are satisfied with the above solution, I’d like to mark this issue as "Answered".
Please also feel free to unmark the issue, with any new findings or concerns you may have.
Thanks,
Sofiya Li
If you have any feedback on our support, please click here.
Sofiya Li
TechNet Community Support -
Need a query to find Grops mapped on Folders
Hi ,
I need a query builder query to find out the list of folder and mapped groups to those folder.
Would you please let me know if that is possible I triead but no luck .
Regards,
NeoHi,
This query sound goods but I get error
Select SI_NAME, SI_KIND From CI_APPOBJECTS, CI_INFOOBJECTS
Where PARENTS("SI_NAME='Myfolder'",'CHILDREN(''SI_NAME=''UserGroup''')")
Please let me know if I am giong in right direction becuse I never used Parents and child concept bit confused.
All I need is when I put in my folder name it has to show me all the groups mapped to it.
If this query gives the result , it will be the great logic I would say
Thanks a ot.
Neo A -
Query to find universe modified date and modified by
Hi,
Is there a way we can query to find universe last modified by and modified date?.
I was not able to find a field to pull "modified by" info.
ThanksSreedhar,
I'm not exactly sure how you're going to get from Point "A" to Point "B", but here are the two points:
a) using QB you can perform a search as was specified in my last posting, which you point out only provides "owner"
b) if you have the Auditor portion running, then in the Audit_Detail table is the column "Detail_Type_ID" and each time a universe is accessed a code "2" is recorded and Detail_Text is loaded with the Universe name. If you join the Audit_Detail table to the Audit_Event table on Event_ID, then you'll have access to User_name and Start_Timestamp, which will show you who and when a Universe was accessed.
Thanks,
John -
Need a Query to find Unassigned Price Lists
Hi
I need a query which will show any Price List NOT assigned to a Business Partner. I have the following:
SELECT T0.[ListNum], T0.{ListName] From OPLN T0
WHERE T0.[ListNum} NOT IN T1.[ListNum[ from OCRD T1
Haven't worked that much with NOT IN statement.
Thank you!Hi Daniel,
Please check below Query.
SELECT T0.[ListNum], T0.[ListName] From OPLN T0 WHERE T0.[ListNum] NOT IN ( SELECT DISTINCT T1.[ListNum] FROM OCRD T1 )
Hope this help
Regards::::
Atul Chakraborty -
Need a Help in finding the start Date and End Date of a week
Dear All,
I need a help,
I have a date for eg,05-08-2009 (Wednesday). i need to get the week's start date and week's end date.
Week start date in my region is SATURDAY and week end date is FRIDAY .
So for my given input it should return start date as 01-08-2009 (Saturday )and end date as 07-08-2009 (Friday ).
Thanks,Got it, Solved by making a small changes to the above code .
SimpleDateFormat sf = new SimpleDateFormat("dd-MMM-yy");
Calendar cal = Calendar.getInstance(Locale.ENGLISH);
cal.set(Calendar.DATE, cal.get(GregorianCalendar.DATE));
cal.set(Calendar.MONTH, cal.get(GregorianCalendar.MONTH));
cal.set(Calendar.YEAR, cal.get(GregorianCalendar.YEAR));
if(cal.get(Calendar.DAY_OF_WEEK) != Calendar.SATURDAY) {
cal.add(Calendar.DATE, -cal.get(Calendar.DAY_OF_WEEK));
String NewEndDate = sf.format(cal.getTime());
cal.add(Calendar.DATE, -7);
String newStartDate = sf.format(cal.getTime());
System.out.println("New Start date :" +newStartDate);
System.out.println("New End Date :" +NewEndDate);Sorry, Dont want to hire any one . Just want to keep my job safe . Any way thanks for your reply . -
Dynamic SQL Query to Find Special Characters in Table columns
Hi,
I am new to OTN FORUMS.
I am trying to find the columnsi of a table which have special characters in them.
I am planning on using this query
select ' select INSTR('||column_name||', chr(0))
from '||table_name||'where INSTR('||column_name||', chr(0)) >0' from user_tab_columns
where table_name='Account'
and spool the output to run as a script.
Is this the right way or do u suggest any modifications to the query?
Thanks in advance.Hi,
I think your basic approach is right. Since you can't hard-code the table- or column names into the query, you'll need dynamic SQL.
Instead SQL-from-SQL (that is, writing a pure SQL query, whose output is SQL code), you could do the whole job in PL/SQL, but I don't see any huge advantage either way.
When you say "Special character<b>s</b>", do you really mean "one given special character" (in this case, CHR(0))?
Will you ever want to search for multiple special characters at once?
What if table foo has a column bar, and in 1000 rows of foo, bar contains CHR (0). Do you want 1000 rows of output, each showing the exact position of the first CHR(0)? If the purpose is to look at theese rows later, shouldn't you include the primary key in the output? What if CHR(0) occurs 2 or more times in the same string?
If you'd rather have one row of output, that simply says that the column foo.bar sometimes contains a CHR(0), then you could do something like this:
SELECT 'foo', 'bar'
FROM dual
WHERE EXISTS (
SELECT NULL
FROM foo
WHERE INSTR ( bar
, CHR (0)
) > 0
); -
Need sql query to find out same item is used in open po and closed po
Hi Experts,
I have an requirement is that, i need to find out the item is used in open po and closed po.
example: A is the item is used in closed PO and Open PO.
i need to write down the scripts how many same items is used in open po and closed po.
if any sql script is there please share.
Please let us know if any concerns.
Thanks
bmnHi
Please try below query
select
distinct c.segment1
from
po_lines_all a,
po_line_locations_all b,
mtl_system_items_b c
where
a.po_line_id= b.po_line_id
and a.item_id=c.inventory_item_id
and b.closed_code='OPEN'
and a.item_id in ( select
item_id
from
po_lines_all d,
po_line_locations_all e,
mtl_system_items_b f
where
d.po_line_id= e.po_line_id
and d.item_id=f.inventory_item_id
and e.closed_code in ('CLOSED','FINALLY CLOSED','CLOSED FOR INVOICE','CLOSED FOR RECEIVING')); -
Sql query to find the scheduled date
I schedule a job for last Thursday of every month. Based on my current date and time I need the date of my next scheduled run of the job...
(i.e) If today is 28-march-2012 (Wednesday) my query should return 3/29/12(which is the last thursday of the month)
If today is 30-march-2012 (Friday) my query should return 4/26/12 (which is the last thursday of next month)
If today is 29-march-2012 and time is 11:00 AM and i have scheduled a job to run at 12:00 PM of last thursday of every month then my query should return 3/29/12
If today is 29-march-2012 and time is 1:00 PM then my query should return 4/26/12924163 wrote:
I schedule a job for last Thursday of every month. Based on my current date and time I need the date of my next scheduled run of the job...
(i.e) If today is 28-march-2012 (Wednesday) my query should return 3/29/12(which is the last thursday of the month)
If today is 30-march-2012 (Friday) my query should return 4/26/12 (which is the last thursday of next month)
If today is 29-march-2012 and time is 11:00 AM and i have scheduled a job to run at 12:00 PM of last thursday of every month then my query should return 3/29/12
If today is 29-march-2012 and time is 1:00 PM then my query should return 4/26/12may be
SQL> ed
Wrote file afiedt.buf
1 with tmp as
2 (
3 select to_date('28-march-2012','DD-month-YYYY') dt from dual union all
4 select to_date('29-march-2012 11:00:00 AM','DD-month-YYYY HH:MI:SS AM') dt from dual union all
5 select to_date('29-march-2012 1:00:00 PM','DD-month-YYYY HH:MI:SS AM') dt from dual union all
6 select to_date('29-march-2012 12:00:00 PM','DD-month-YYYY HH:MI:SS AM') dt from dual union all
7 select to_date('29-march-2012 11:59:00 AM','DD-month-YYYY HH:MI:SS AM') dt from dual union all
8 select to_date('30-march,2012','DD-month-YYYY') dt from dual
9 )
10 select dt,
11 case
12 when Next_day(Add_months(Trunc(dt, 'MM'), 1) - 7, 'thursday') + ( 12 /
13 24 ) >
14 dt then Next_day(Add_months(Trunc(dt, 'MM'), 1) - 7, 'thursday')
15 else Next_day(Add_months(Trunc(dt, 'MM'), 2) - 7, 'thursday')
16 end new_dat
17 from tmp
18* order by dt
SQL> /
DT NEW_DAT
28-Mar-2012 12:00:00 AM 29-Mar-2012 12:00:00 AM
29-Mar-2012 11:00:00 AM 29-Mar-2012 12:00:00 AM
29-Mar-2012 11:59:00 AM 29-Mar-2012 12:00:00 AM
29-Mar-2012 12:00:00 PM 26-Apr-2012 12:00:00 AM
29-Mar-2012 01:00:00 PM 26-Apr-2012 12:00:00 AM
30-Mar-2012 12:00:00 AM 26-Apr-2012 12:00:00 AM
6 rows selected.
SQL> -
Need a Query to find whether the database needs any media recovery...
Hi,
I am at the mount stage of a database and yet be opened.at this stage any Query is available or any other way is there to find whether the database needs any media recovery or Instance recovery..?
my objective is before opening the database i need to make sure it is consistent or inconsistent and any form of recovery is needed..
thanks ®ards,
Ragunath
Edited by: ragu.dba.in on Mar 6, 2013 12:57 AMHi Ragunath,
Use these queries , SCN should be consistent .. no fuzzy files, check for recovery of files in v$recover_file .. pass sufficient archives & fulfill the checks before open reset-logs
set line 900
set pages 900
set echo on
alter session set nls_date_format='dd-mon-yyyy hh24:mi:ss';
set numwidth 13
col CHECKPOINT_CHANGE# for 9999999999999999
col CHANGE# for 9999999999999999
column error format a10
column member format a60
show parameter db_recover
select * from v$recover_file;
select file#, status from v$datafile;
select file#, checkpoint_change#, checkpoint_time, error from v$datafile_header;
select distinct status from v$backup;
select distinct checkpoint_change# from v$datafile_header;
select hxfil file_id, fhscn scn, fhthr thread, fhrba_seq sequence, fhsta status from x$kcvfh;
select distinct fhscn from x$kcvfh;
select hxfil file_id, fhtnm tablespace_name from x$kcvfh;
##### Fuzzy Check ####
alter session set nls_date_format = 'DD-MON-YYYY HH24:MI:SS';
set feedback on
set heading on
set pagesize 1000
set linesize 175
column checkpoint_change# format 999999999999999999999
select status, checkpoint_change#, fuzzy,
to_char(checkpoint_time, 'DD-MON-YYYY HH24:MI:SS') as checkpoint_time,
count(*)
from v$datafile_header
group by status, checkpoint_change#, fuzzy, checkpoint_time
order by status, checkpoint_change#, fuzzy, checkpoint_time;Thanks,
Ajay More
http://www.moreajays.com -
SQL Query to find when the data was committed
Hi,
In oracle how do we find the when the row as committed into DB(Timestamp):
Eg:
If insert 1000 records from the application i want to know what is exact time the data was committed in the DB.
Regards
NMNM wrote:
Hi,
Thanks for your Input.
The Query returned the following.But I want something like this 7/6/2011 6:43:54.23:32:00000 PM(Includes micro seconds)
SELECT ora_rowscn,orderid FROM tibex_order where orderid='0NEC.000OXNVE9JYSNQC' ;
12541143230,0NEC.000OXNVE9JYSNQC
SELECT SCN_TO_TIMESTAMP(ORA_ROWSCN) FROM tibex_order where orderid='0NEC.000OXNVE9JYSNQC' ;
7/6/2011 6:43:54.000000000 PMRegards
NMIt's already giving it to you in nano-seconds.
What's with this format:???
But I want something like this 7/6/2011 6:43:54.23:32:00000 PM
^ ^ ^ ^^^
| | | ||+-- what is this colon for?
| | | |+--- hundredths of seconds
| | | +---- tenths of seconds
| | +------- seconds
| +---------- minutes
+------------ hour -
Need sql query to find out Joins attached with folders in Discoverer
Hi,
Can anyone let me know the sql query which can be used to identify the joins which are attached to the folders.
Actually we have to identify all the joins conditions from folders those are migrated from one instance to others.
Thanks
abhishekI recommend that you implement the admin EUL supplied by oracle, you can get there a lot of repository information (metalink note: 556932.1).
Try to use this (maybe you will need some pkg's):
SELECT
DECODE(KEYS.FK_MANDATORY,
1,
'Always exist in master folder',
'Might not exist in master folder') "Detail Item values",
EUL10G_US.EUL5_GET_JOIN(EXP.EXP_ID, 'N') "Join Master --> Detail",
KEYS.KEY_DESCRIPTION JOIN_DESCRIPTION,
KEYS.KEY_DEVELOPER_KEY JOIN_IDENTIFIER,
KEYS.KEY_NAME JOIN_NAME,
DECODE(SUBSTR(KEYS.KEY_NAME, 1, 19),
'AUTO_GENERATED_NAME',
'Yes',
'No') "AutoGen",
DECODE(DECODE(SUBSTR(KEYS.KEY_NAME, 1, 19),
'AUTO_GENERATED_NAME',
'Yes',
'No') ,
'Yes',
EUL10G_US.EUL5_GET_JOIN(EXP.EXP_ID),
KEYS.KEY_NAME) "Actual Join Name",
KEYS.KEY_UPDATED_DATE JOIN_LAST_UPDATE,
DECODE(KEYS.FK_ONE_TO_ONE, 1, 'One to one join', NULL) "One to One join",
DECODE(KEYS.FK_MSTR_NO_DETAIL,
1,
'Outer join on detail' || CHR(10),
NULL) "Outer Join on Detail",
DECODE(KEYS.FK_DTL_NO_MASTER,
1,
'Outer join on master' || CHR(10),
NULL) "Outer Join on Master",
DECODE(KEYS.FK_MSTR_NO_DETAIL,
1,
'Outer join on detail' || CHR(10),
NULL) || DECODE(KEYS.FK_DTL_NO_MASTER,
1,
'Outer join on master' || CHR(10),
NULL) ||
DECODE(KEYS.FK_ONE_TO_ONE, 1, 'One to one join', NULL) "Optional Join Configurations",
OBJ.OBJ_NAME "MASTER_FOLDER",
OBJ_DETAIL.OBJ_NAME "DETAIL_FOLDER"
FROM EUL10G_US.EUL5_OBJS OBJ,
EUL10G_US.EUL5_EXPRESSIONS EXP,
EUL10G_US.EUL5_KEY_CONS KEYS,
EUL10G_US.EUL5_OBJS OBJ_DETAIL
WHERE ((KEYS.KEY_ID = EXP.JP_KEY_ID) AND
(OBJ.OBJ_ID = KEYS.FK_OBJ_ID_REMOTE) AND
(OBJ_DETAIL.OBJ_ID = keys.KEY_OBJ_ID)); -
Need sql query to find out Joins attached with folders
Hi,
Can anyone let me know the sql query which can be used to identify the joins which are attached to the folders.
We dont want to see those from front end(disc admin).
Thanks
abhishekabhishek - This is the Application Express forum. I have no idea what you are asking but it may need to be directed to a different forum.
Scott
Maybe you are looking for
-
"cannot find Arial MT font" error
I have Windows 7 and Adobe 11... Having a problem with some documents saying "cannot find Arial MT font"... some parts of a document will just have dots. I didn't have this problem w/Windows XP & older version of Adobe. I've gone back to Adobe 9.5
-
Dyslexia font not working in all incoming emails
Dear Mozilla Support, Monday 5-5th-2014 I have Dyslexia and recently started using fonts for the disorder on my PC and e-reader. This increased my reading speed dramatically with better retention. Kind of a big deal for me as I use the PC & web lot.
-
Default the viewer to Microsoft Excel instead of PDF
I have a RTF template created for the report. I need the output to be of type Microsoft Excel. When I submit the request, automatically it defaults the output type to PDF. When I go into Options in the Submit Request screen and manually change the LA
-
TS4337 How do I highlight an entry in the calendar on my iPad?
I am trying to highlight entries in my calendar and am wondering how to do this. Help?
-
Labelling photos within an 'Event'
Can I label photos within an Event folder - i.e. to show different cities visited on the same trip?