Helps the GREP query
Hello
I'm struggling with a Grep style and need a little help.
I write a manual containing many examples of code and you want to apply the color to the text inside "double quotes".
Grep query ("? < =------="). + ? ("? =") is almost what I need but if it finds "" the query seems to stop to find anything afterwards.
The------= in the look ahead is because the first "always follows a =
For example:
"" < page PREVIEWTEXT = "1" name ="previewtext1" column = "1" rowspan ="6"invite"" width = "250" height = "290" / > "
After the prompt empty"", the search query is no longer "250" or "290".
Anyone has any idea why?
Thank you.
And, in the case where you think that this is already a total mystery:
I wondered what would happen with quotes. After all, the GREP search was to treat each of them even. Well - it does not work. The "\x{22" code} forces a straight quotation mark, so it will never match those curly. Fortunately, you can use a group for inclusion in the postanalyse:
(? == [quote straight + curly quote open + curly close quote])
(written in full so you can see what I've done.) But I accidentally stumbled upon this:
(?<==["])[^"]+?(?=")
... it works for all possible combinations of straight open, curly and curly close quotes... Remove the [] in the postanalyse and it no longer works. Add them and it works again.
Tags: InDesign
Similar Questions
-
Need help with GREP query-extract
Hi people,
I'm trying to harden a GREP query, I have reconstitute.
This discovery channel allows me to search for text in the < ex > tags and remove the tags themselves. We then apply the Exchange my extract paragraph style field.
( ? s). (< ex > *) (.+?) (* < /ex >)
What I need to do is add a blank line above and below the excerpt. In addition to the string?
TIA
Yes, by changing to \r$2\r
BUT this text is already a paragraph? If this is the case, it would be preferable to add a space before and after as part of the style. If this isn't the case, I'm not sure that adding the returns in the same operation will not change the text from which it is extracted, then you want to find all first
. +? change \r$0\r without change the formatting and then run that you now have to change the format on the excerpt. -
Hi all
Please check this logic:
Select * from table v
If ([[Conf]] = 'Device') {}
v.xindex > 100 and v.xindex < 499
} ElseIf ([[Conf]] = "notdevice") {}
v.xindex < 100 and v.xindex > 499
} ElseIf ([[Conf]] = 'all') {}
v.xindex > 1
} ElseIf ([[Conf]] = ") {}
v.xindex > 1
}
I want that this put in a sql query, am not able to understand. Help, please.
Published by: user12060144 on January 22, 2010 07:37
Published by: user12060144 on January 22, 2010 07:38Hello
A way
select * from table v where (conf ='Device' and v.xindex>100 and v.xindex<499) or (conf ='notdevice' and v.xindex<100 and v.xindex>499) or (conf = 'all' and v.xindex > 1) or (conf is null and v.xindex >1)
Concerning
Anurag -
I have three paintings, photos, reviews and prices. Their structures (for short) are as follows:
photos
---------------------
photoID
photoTitle
price
---------------------
priceID
priceValue
photoID_fk
Comments
----------------------
IDCommentaire
commentText
photoID_fk
What I need to do, is to be able to display a list of photos with their price and their comments, autocorrelation, as follows:
Photo 1
Price 1
Price 2
Comment 1
Comment 2
Photo 2
Price 1
Price 2
Photo 3
Price 1
Price 2
Comment 1
Note that while each photo will always have the same number of values of 'price', some might have comments and some could not.
I will list the code I have so far, but let me briefly explain what is happening. With the installation I currently, photos in the right order with their values at good price and display comments (if any). Unfortunately, on WITH those comments, the price list of duplicates to match the number of comments returned. So, if Photo 1 has two comments, it will return '1 2 1 2 price price price' for the release of the Awards section.
I've been pulling my hair over this, and any help that anyone can provide would be greatly appreciated and will potentially save my life.
Dan-
Thanks, as always, for your response. Your solution solved the problem!
As for my database needs, comments are only pictures.
Basically I have a table that contains all the information about the photos in a gallery. I have another table that holds all the comments that users make on photos. Finally, each photo has 8 sizes (all the same) for sale. So, I don't think that the MTM relationship is there.
Initially, I was just going to put Size1, Size2, etc. in the pictures table. However, my client wants to be able to add and/or remove sizes in the future. Therefore, I thought it would be easier if each photo has been given 'x' number of entries in the price table, where 'x' is the number of categories of total price (currently 8).
I don't want to monopolize more time, but if you have a second, I'd be interested to hear an expanded explanation of the restructuring that you proposed at the end of your last response. If you have no time, of course I understand.
Thanks for your help on this 1 million!
-
Helps the simple query XPath in OSB
Hello!
I try to extract a part of XML with Oracle Service Bus using XPath message, but I can't find the way to make
For testing purposes, I initialize a variable 'test' with an action of assignment with the following content:
< Country > < country > < COUNTRY > ARE < / COUNTRIES > < S EU_COUNTRY > < / EU_COUNTRY > < Spain NUMBER > < / NUMBER > < ID > 1 < /ID > < country > < / country >
Can I use following code to access the COUNTRY element but I get blank result:
$test, Countries, Country, COUNTRY / text)
I'm rather new to XPath, but I think that this expression should work.
Could someone give me some advice?
Thank you.
Published by: user542345 on June 15, 2011 09:06Use
$test / country/COUNTRY/text)
-
Hello.. all the
but when I try something like this;SELECT 'X' FROM DOH WHERE DOH_NO IN (2,4); ' - X X Works fine..
Returns the error, how to achieve the result of the later as the first.var REF_NO varchar2(10); exec :REF_NO := '2,4'; SELECT 'X' FROM DOH WHERE DOH_NO IN (:REF_NO); SQL> var REF_NO varchar2(10); SQL> exec :REF_NO := '2,4'; PL/SQL procedure successfully completed. SQL> SQL> SELECT 'X' FROM DOH 2 WHERE DOH_NO IN (:REF_NO); WHERE DOH_NO IN (:REF_NO) * ERROR at line 2: ORA-01722: invalid number
TYYou must divide the string:
SQL> create table doh as select level col from dual connect by level <= 6; Table created. SQL> select * from doh; COL ---------- 1 2 3 4 5 6 6 rows selected. SQL> var ref_no varchar2(10); SQL> exec :ref_no := '2,4'; PL/SQL procedure successfully completed. SQL> select * 2 from doh 3 where col in (select column_value 4 from table(cast(multiset(select substr( str 5 , instr (str, ',', 1, level ) + 1 6 , instr (str, ',', 1, level+1) - instr (str, ',', 1, level) -1 7 ) 8 from ( select ','||:ref_no||',' str 9 from dual 10 ) 11 connect by level <= length(str)-length(replace(str,',',''))-1 12 ) 13 as sys.odcinumberlist 14 )) 15 ); COL ---------- 2 4
You can find many examples on this forum, I suggest you do a search to find several approaches...
Edit
A bit shorter, using regexp ;)
SQL> exec :ref_no := '2, 3, 4'; PL/SQL procedure successfully completed. SQL> select * 2 from doh 3 where col in ( select regexp_substr (str, '[^,]+', 1, level) 4 from ( select :ref_no str 5 from dual 6 ) 7 connect by level <= length(replace (str, ',', null)) 8 ); COL ---------- 2 3 4
Published by: hoek on December 14, 2009 12:02
-
Help with sql query / a subquery to perform the COUNT
Hello everyone,
Co-worker colleague asked me to post a request here in hopes of getting more support. Here's the question:
There are 3 tables associated with this request. A table of the application, which displays a number of application open for a particular request, an audit table that shows you all employees who worked on this application and one employee who shows you the details of the employee table. My colleague is trying to understand what, how to see only applications that have been published by a wizard, but not a Manager. There are a few applications that worked on both, but he won't see this request in its results.
Here are the tables
EMP
ID FULL_NAME 1234 John Doe 5467 Jane Doe 2345 Clark Kent 5432 June Cleaver Unfortunately, this table does not have a title column (which was created provider, so we cannot change the internal structure). My colleague knows who is the Assistant and the Director, then in this case, the first two of the id:
1234 and 5467 are managers and the other 2 are assistants
T_APPLICATION
app_id app_number date_opened app_type 9018 54778 JANUARY 10, 2014 NETWORK 9019 54779 JANUARY 11, 2014 DATABASE 9010 55000 MARCH 12, 2014 MATERIAL T_APP_AUDIT
APP_ID PROCESSED_BY 9018 1234 9018 2345 9018 5432 9019 2345 9019 5432 9010 5432 So, here is the actual query, I was given: it is actually to check the number of times that each application has been published per person:
Select a.app_id, c.full_name, count (*) that controls
t_application a, t_app_audit b, c of the emp
where a.app_id = b.app_id and b.processed_by = c.id and
a.app_type in ('NETWORK', "DATABASE")
and b.processed not in ('1234, ' 5467')
GROUP OF A.APP_ID, c.full_name;
IF I won't see 9018 in my results, since at one time it was edited by a Manager (1234). Unfortunately, this request does not eliminate the app_id 9018, it eliminates only the name of handlers appear in the query. I hope I've explained this properly, and any help to point us in the right direction is welcomed. Thanks in advance.
Select
a.app_id
c.full_name
, count (*) as the controls
of t_application one
t_app_audit b
c of the emp
where a.app_id = b.app_id
and b.processed_by = c.id
and a.app_type in ('NETWORK', "DATABASE")
and b.app_id by (not in
Select app_id
of t_app_audit
where processed_by in ('1234, ' 5467')
)
GROUP OF A.APP_ID, c.full_name;
-
Hello Experts
I can't in select the record_sequence in the output. Please see the part of the desired effect.
Please help solve this problem.
Is the version of Oracle, I'm working on that
Oracle Database 11 g Enterprise Edition Release 11.1.0.7.0 - 64 bit Production
With partitioning, OLAP, Data Mining and Real Application Testing options
Thank you
RB
TABLE1 AS
(
SELECT '28' EXAM_CD1, EXAM_CD2 '29', '10' EXAM_CD3, 111' CAND_ID FROM DUAL UNION ALL
SELECT '21' EXAM_CD1, EXAM_CD2 '39', '20' EXAM_CD3, 112' CAND_ID FROM DUAL UNION ALL
SELECT '22' EXAM_CD1, EXAM_CD2 '49', '30' EXAM_CD3, 113' CAND_ID FROM DUAL UNION ALL
SELECT 'EXAM_CD1 23', '59' EXAM_CD2, EXAM_CD3 ' 40', 114' CAND_ID FROM DUAL UNION ALL
SELECT '24' EXAM_CD1, EXAM_CD2 '69', '50' EXAM_CD3, 115' DOUBLE CAND_ID)
AS TABLE2
(
SELECT EXAM_CD '28', '111' CANDID, 1 RECORD_SEQ OF DOUBLE UNION ALL
SELECT '30' EXAM_CD, '113' CANDID, 2 RECORD_SEQ FROM DUAL UNION ALL
SELECT EXAM_CD '94', '111' CANDID, 3 RECORD_SEQ OF DOUBLE UNION ALL
SELECT EXAM_CD '69', '115' CANDID, 4 DOUBLE RECORD_SEQ)
(
SELECT EXAM_CD FROM TABLE2, CANDID
LESS
SELECT CAND_ID,
MAX (L CASE WHEN 1 EXAM_CD1 THEN WHEN 2 THEN of OTHER EXAM_CD2 EXAM_CD3 END) exam_code
FROM TABLE1,
(SELECT LEVEL L FROM DUAL CONNECT BY LEVEL < = 3)
CAND_ID GROUP, L)
The aim is
CAND_ID, EXAM_CD, RECORD_SEQ
* 111, 94, 3 *.Hello
Rb2000rb65 wrote:
The solution use not less as long as I get my results using the latest features, it is good with me.Good idea!
UNMIS is not the best tool for this task. The saved query gets the exam_cd and the Candide you want, but you can't find the record_seq because there of nothing like record_seq in table1.You can do this way:
SELECT * FROM table2 m WHERE NOT EXISTS ( SELECT 1 FROM table1 WHERE m.candid = candid AND m.exam_cd IN ( exam_cd1 , exam_cd2 , exam_cd3 ) ) ;
I guess you could use LESS, like this
SELECT * FROM table2 WHERE (exam_cd, candid) IN ( SELECT ... -- The MINUS query you posted goes here ) ;
but it is unecessarily complicated.
-
Hello!
I m facing a problem with the help of oraext: query-database.
In my transformation im try the following (Simplified):
How to get the correct value when you use oraext:query - database?<xsl:template match="*"> <xsl:variable sqlQuery="select ....."/> <xsl:variable name="storeSec" select="oraext:query-database($sqlQuery,true(),true(),'jdbc/xref')/> <xsl:choose> <xsl:when test="string-length($storeSec/ROWSET/ROW[1]/STORE_PART_SECTION) > 0"> <xsl:value-of select="$storeSec/ROWSET/ROW[1]/STORE_PART_SECTION"/> </xsl:when> <xsl:otherwise> <xsl:value-of select"some other val"/> </xsl:otherwise> </xsl:choose> </xsl:template> {code} This always results in +some+ +other+ +val+ !! I´v checked the output from oraext:query-database by using getcontentAsString and if I instead test putting the expected output from oraext:queryDatabase in my variable it gives me A100 which is what i expected. {code} <xsl:template match="*"> <xsl:variable sqlQuery=select ....."/> <xsl:variable name="storeSec"> <ROWSET> <ROW num="1"> <STORE_PART_SECTION>A100</STORE_PART_SECTION> </ROW> <ROW num="2"> <STORE_PART_SECTION>XXm</STORE_PART_SECTION> </ROW> </ROWSET> </xsl:variable> <xsl:choose> <xsl:when test="string-length($storeSec/ROWSET/ROW[1]/STORE_PART_SECTION) > 0"> <xsl:value-of select="$storeSec/ROWSET/ROW[1]/STORE_PART_SECTION"/> </xsl:when> <xsl:otherwise> <xsl:value-of select"some other val"/> </xsl:otherwise> </xsl:choose> </xsl:template>
How should you exit? Several item ID with each having a value of the result set?
If Yes, then you can try following: -
Help! 'Submit query' in the Send button?
Hello! ... Please see the "Submit Query" message inside my button "submit" below
How can I get rid of him? ... or is there a code error?... I can't find it... check the code below
< do action = "/ FormProcessv2.aspx?" WebFormID = 65717 & amp; OID = {module_oid} & amp; OTYPE = {module_otype} & amp; EID = {module_eid} & amp; CID = {module_cid} & amp; SAR = false PageID = 10857312 "enctype =" multipart/form-data"onsubmit ="return checkWholeForm27006 (this)"method ="post"name ="catwebformform27006"autocomplete ="off">
< table cellspacing = "0" cellpadding = "0" border = "0" >
< tbody >
< b >
< style td = "" width: 300px; "> < label ="First name"ID = 'label' class ="fld-label actAsDiv contactform grpelem clearfix"> name < span class ="req"> * </span > < / label > < br / >"
< input type = "text" maxlength = "255" class = "cat_textbox" id = "First name" name = "FirstName" / > < table >
< style td = "" width: 50px; ' > < table > "
< style td = "" width: 300px; "> < label ="As WorkPhone"ID = 'label' class ="fld-label actAsDiv contactform grpelem clearfix"> business phone number < / label > < br / >"
< input type = "text" maxlength = "255" class = "cat_textbox" id = "As WorkPhone" name = "As WorkPhone" / > < table >
< /tr >
< b >
< td colspan = "3" > < table >
< /tr >
< b >
< style td = "" width: 300px; "> < label ="LastName"ID = 'label' class ="fld-label actAsDiv contactform grpelem clearfix"> name < span class ="req"> * </span > < / label > < br / >"
< input type = "text" maxlength = "255" class = "cat_textbox" id = "LastName" name = "LastName" / > < table >
< style td = "" width: 50px; ' > < table > "
< style td = "" width: 300px; "> < label = id of 'Society' = 'label' class ="fld-label actAsDiv contactform grpelem clearfix"> company < / label > < br / >"
< input type = "text" maxlength = "255" class = "cat_textbox" id = "name" = "Company" / > < table >
< /tr >
< b >
< td colspan = "3" > < table >
< /tr >
< b >
< td > < label = "EmailAddress" ID = 'label' class = "fld-label actAsDiv contactform grpelem clearfix" > E-mail address < span class = "req" > * </span > < / label > < br / >
< input type = "text" maxlength = "255" class = "cat_textbox" id = "EmailAddress" name = "EmailAddress" / > < table >
< style td = "" width: 50px; ' > < table > "
< style td = "" width: 300px; "> < table >"
< /tr >
< b >
< td colspan = "3" > {module_ccsecurity} < table >
< /tr >
< / tbody >
< /table >
< table cellspacing = "0" cellpadding = "0" border = "0" >
< tbody >
< b >
< td colspan = "4" > < table >
< /tr >
< b >
< style td = "" width: 300px; "> < label ="CAT_Custom_334760"ID = 'label' class ="fld-label actAsDiv contactform grpelem clearfix"> how did you hear about us: < / label > < br / >"
< select class = "form cat_dropdown" id = "CAT_Custom_334760" name = "CAT_Custom_334760" >
"< option value =" ">--please select--< / option >".
< option value = "Colleague" > fellow < / option >
< option value = "Search" > Search online < / option >
< option value = 'LinkedIn' > LinkedIn < / option >
< option value = "Puts a demonstration" > met at an event < / option >
< / select > < table >
< style td = "" width: 50px; ' > < table > "
< style td = "" width: 20px; "> < input type ="checkbox"value ="1"id ="CAT_Custom_334761"name ="CAT_Custom_334761"/ > < table >"
< style td = "" width: 280px; ">"
< label ID = "CAT_Custom_334761" = 'label' class = "fld-label actAsDiv contactform1 grpelem clearfix" > add me to your email list < / label > < table >
< /tr >
< b >
< td colspan = "4" > < table >
< /tr >
< b >
< style td = "" width: 650px; "colspan ="4"> < label ID ="CAT_Custom_334762"= 'label' class ="fld-label actAsDiv contactform grpelem clearfix"> how can I help: < / label > < br / >"
< textarea onkeydown = "if (this.value.length & gt; = 4000) this.value = this.value.substring (0,3999);" class = "cat_listbox contactform1" rows = "4" cols = "10" id = "CAT_Custom_334762" name = "CAT_Custom_334762" > < / textarea > < table >
< /tr >
< b >
< td colspan = "4" > < table >
< /tr >
< b >
< style td = "" width: 650px; "colspan ="4"> < input type ="submit"id ="catwebformbutton"class ="cat_button u4433-17"/ > < table >"
< /tr >
< / tbody >
< /table >
"< script type =" text/javascript"src="/CatalystScripts/ValidationFunctions.js "> < / script >
< script type = "text/javascript" >
<! [CDATA]
var submitcount27006 = 0; function checkWholeForm27006 (theForm) {var why = ""; if (theForm.FirstName) why += isEmpty (theForm.FirstName.value, "Name");} If (theForm.LastName) why += isEmpty (theForm.LastName.value, "Last name"); If (theForm.EmailAddress) why += checkEmail (theForm.EmailAddress.value); If (why! = "") {alert (why);} return false ;} If (submitcount27006 == 0) {submitcount27006 ++; theForm.submit (); return false ;}; else {alert ("the form submission is in course."); return false ;}}}}
[]] >
< /script >
< / make >
text-indent:-9999px;
OR better if you switch you can style just pure CSS and stationary state etc. without the use of images.
-
Helps the query using case and County
Hello!
I have problems with a small part of a query below that finally can settle the invoice price.
(count (distinct spm97.sample_id) * 36.1) as "PROFILE."
case count (distinct spm33.sample_id)
When (count (distinct spm97.sample_id) = 0) then (count (distinct spm33.sample_id) * 26)
another (count (distinct spm33.sample_id) * 4.75)
put an end to 'CC ',.
The first line works - 0 or 36.10 is returned depending on whether or not a profile has been ordered for the sample.
The cost of CC is 4.75 if a profile was also sentenced, if it isn't then the cost is 26. The case statement is supposed to verify this and return the exact amount, but I can't make it work... I get the error message that a closing parenthesis is missing somewhere in the middle of line 3, if that helps.
Any advice would be much appreciated! Of course, this isn't the entire query - joins and all are all working well, it's just this little section with the County that I can't just.
Thank you
JOthe piece of code below, seems to me is incorrect
CASE COUNT(DISTINCT spm33.sample_id) WHEN ( COUNT(DISTINCT spm97.sample_id) = 0 ) THEN (COUNT(DISTINCT spm33.sample_id) * 26) ELSE (COUNT(DISTINCT spm33.sample_id) * 4.75) END AS "CC"
It seems that the requirement here is that if * 'COUNT (DISTINCT spm97.sample_id) = 0' *, then * "CC" * should be ' COUNT (DISTINCT spm33.sample_id) (* 26) "ELSE, it should be" COUNT (DISTINCT spm33.sample_id) (* 4.75)»
If this is the case, the statement must include:CASE COUNT(DISTINCT spm97.sample_id) WHEN 0 THEN (COUNT(DISTINCT spm33.sample_id) * 26) ELSE (COUNT(DISTINCT spm33.sample_id) * 4.75) END AS "CC"
-
helps the load by clause of the query.
guys I have a table like this
with data like this.create table fgbtrnh ( fgbtrnh_doc_code varchar2(9), fgbtrnh_trans_date date, fgbtrnh_trans_amt number(17,2), fgbtrnh_acct varchar2(6) , fgbtrnh_fund_code varchar2(6), fgbtrnh_rucl_code varchar2(6) );
I would like to get a total run of these elements, so I tried something like that.insert into fgbtrnh( fgbtrnh_doc_code,fgbtrnh_trans_date,fgbtrnh_trans_amt,fgbtrnh_acct,fgbtrnh_rucl_code,fgbtrnh_fund_code) values('J0005445','31-MAY-10','38491','6001','BD01','360098'); insert into fgbtrnh( fgbtrnh_doc_code,fgbtrnh_trans_date,fgbtrnh_trans_amt,fgbtrnh_acct,fgbtrnh_rucl_code,fgbtrnh_fund_code) values('L0000005','01-JUL-08','38260','6001','BD01','360098'); insert into fgbtrnh( fgbtrnh_doc_code,fgbtrnh_trans_date,fgbtrnh_trans_amt,fgbtrnh_acct,fgbtrnh_rucl_code,fgbtrnh_fund_code) values('L0000002','30-JUN-08','24425.29','6001','BD01','360125'); insert into fgbtrnh( fgbtrnh_doc_code,fgbtrnh_trans_date,fgbtrnh_trans_amt,fgbtrnh_acct,fgbtrnh_rucl_code,fgbtrnh_fund_code) values('L0000002','30-JUN-08','48057.71','6001','BD01','360125'); insert into fgbtrnh( fgbtrnh_doc_code,fgbtrnh_trans_date,fgbtrnh_trans_amt,fgbtrnh_acct,fgbtrnh_rucl_code,fgbtrnh_fund_code) values('M0000002','30-JUN-08','90','7200','BD01','360098');
but I find myself with a result set asselect f.fgbtrnh_doc_code,f.fgbtrnh_trans_date,f.fgbtrnh_trans_amt, sum(f.fgbtrnh_trans_amt) over (--partition by f.fgbtrnh_doc_code order by fgbtrnh_trans_date desc ROWS UNBOUNDED PRECEDING --group by f.fgbtrnh_doc_code )total From fgbtrnh f where f.fgbtrnh_fund_code in ('360098', '360125') and f.fgbtrnh_rucl_code = 'BD01' and f.fgbtrnh_acct = '6001' order by f.fgbtrnh_trans_date desc, f.fgbtrnh_doc_code
'FGBTRNH_DOC_CODE', 'FGBTRNH_TRANS_DATE', 'FGBTRNH_TRANS_AMT', 'TOTAL '.
"J0005445", MAY 31, 10, 38491, 38491
"L0000005", 1 JULY 08, 38260, 76751
"L0000002", 30 JUNE 08, 24425.29, 101176.29
"L0000002", 30 JUNE 08, 48057.71, 149234
I want to thave the cumulative total to start at the bottom in the other Word is my total column I would like to finish with the top 149234
so it should look something like this.
'FGBTRNH_DOC_CODE', 'FGBTRNH_TRANS_DATE', 'FGBTRNH_TRANS_AMT', 'TOTAL '.
"J0005445", MAY 31, 10, 38491, 149234
"L0000005", 1 JULY 08, 38260, 110743
"L0000002", 30 JUNE 08, 24425.29, 72483
"L0000002", 30 JUNE 08, 48057.71, 48057.71
I've tried everything and can't seem to make this work can someone please point me in the right direction.
I would really appreciate the help.
Thank you
MiguelHi, Miguel.
mlov83 wrote:
... Also, if you order only the lines, you won't need the windowing clause ("UNBOUNDED PRECEDING LINES"); the default value ("RANGE UNBOUNDED PRECEDING") will have exactly what you want, so you n;' no need to say it.I don't really understand what you mean by that? But if I take a quick glance you say that all my lines will have to be unique, and then I won't have to use ("UNBOUNDED PRECEDING LINES")
I think you have guessed it right.
The ORDER BY clause Analytics don't have to result in a single ranking. There are good reasons for having a single oprdering, and there are good reasons for not having a single collation.
I mean that If the analytical ORDER BY is unique, then you need not to give a widnowing clause, such as the "LINES OF UNBOUNDED'.Frank sorry if im asking some really stupid questions, but I have tried and tried to read and understand "partion by" and "over" works, but I'm not quite sure I understand yet.
It's not stupid at all! Analytical functions can be very subtle and confusing.
We will use a query based on the table scott.emp, which includes lines for each seveal deptno.
-- Tell SQL*Plus to put a blank line between deptnos, just to make the output easier to read BREAK ON deptno SKIP 1 DUPLICATES SELECT deptno , ename , sal , SUM (sal) OVER ( PARTITION BY deptno ORDER BY sal ROWS UNBOUNDED PRECEDING ) AS running_total FROM scott.emp ORDER BY deptno , sal DESC , ename ;
Output:
` DEPTNO ENAME SAL RUNNING_TOTAL ---------- ---------- ---------- ------------- 10 KING 5000 8750 10 CLARK 2450 3750 10 MILLER 1300 1300 20 FORD 3000 10875 20 SCOTT 3000 7875 20 JONES 2975 4875 20 ADAMS 1100 1900 20 SMITH 800 800 30 BLAKE 2850 9400 30 ALLEN 1600 6550 30 TURNER 1500 4950 30 MARTIN 1250 2200 30 WARD 1250 3450 30 JAMES 950 950
PARTITION BY deptno"means to do a separate calculation for each distinct value of deptno. Lines with deptno = 10 effect the outcome on the lines where deptno = 20 or deptno = 30. Since there are 3 distinct values of deptno, there are 3 separate running totals.
Note that the analytical ORDER BY clause translates into only a partial ranking. If there are two or more lines in the same deptno who have the same sal, look what can happen:
{code}
"DEPTNO ENAME SAL RUNNING_TOTAL.
---------- ---------- ---------- -------------
... 30 1500 4950 TURNER
30 MARTIN 1250 2200
1250 3450 DISTRICT 30
30 JAMES 950 950
{code}
MARTIN and WARD are in the same partition (deptno = 30), and they both have the same sal (1250), so there is no reason why one of these lines would be considered 'before' it. When you use a windowing clause based on the LINES, as stated above, and there is equality for which line comes first (as there is equality between MARTIN and WARD), then one of the lines will arbitrarily be condidered before this one. In this example, it happened to chose MARTIN as the 2nd lowest sal, so running_total = 2200 (= 950 + 1250) on the line for MARTIN and running_total = 3450 (950 + 1250 + 1250) on the WARD line. There is no particular reason for this; It is completely arbitrary. I could do exactly the same question tomorrow or in 10 minutes and get running_total = 2200 to the rank of WARD and 3450 on MARTIN.
However, it is no coincidence that MARTIN comes before WARD at the exit. the * request * ORDER BY clause (which has nothing to do with the analytical ORDER BY clause) ensures that, when two lines have the same deptno and sal, then the one with the earlier ename will come first.Now, what is the difference between a window based on the LINES and a window on the BEACH bnased?
One difference is that, when a link appears in the ORDER BY clause, all rows with the same value of sal get the same value for SUM (sal):
{code}
SELECT DeptNo
ename
sal
SUM (sal) over (PARTITION BY deptno
ORDER BY sal
) AS running_total
FROM scott.emp
ORDER BY deptno
sal DESC
ename
;
{code}
Note that the only difference between the first query above, and this one is that it does not have an analytical windowing clause, then the default window, * RANGE * UNBOUNDED PRECEDING is used.
Output:
{code}
"DEPTNO ENAME SAL RUNNING_TOTAL.
---------- ---------- ---------- -------------
10 5000 8750 KING
10 2450 3750 CLARK
10 1300 1300 MILLER20 FORD 3000 10875
20 3000 10875 SCOTT
20 JONES 2975 4875
20 1100 1900 ADAMS
20 SMITH 800 80030 2850 9400 BLAKE
30 1600 6550 ALLEN
30 1500 4950 TURNER
30 MARTIN 1250 3450
1250 3450 DISTRICT 30
30 JAMES 950 950
{code}
Again, look MARTIN and WARD near the end. They have both the sal of the soul, so they both have the same running_total = 3450 (= 950 + 1250 + 1250). This is often a desirable outcome, but in your case, it seems not to be. If you want running_totals MARTIN and WARD, then recesses you must use a window LINE, as we have done previously, or add a breakage in the ORDER BY clause, like this:
{code}
SELECT DeptNo
ename
sal
SUM (sal) over (PARTITION BY deptno
ORDER BY sal
, ename DESC - changed (this is the only change)
) AS running_total
FROM scott.emp
ORDER BY deptno
sal DESC
ename
;
{code}
Output:
{code}
"DEPTNO ENAME SAL RUNNING_TOTAL.
---------- ---------- ---------- -------------
10 5000 8750 KING
10 2450 3750 CLARK
10 1300 1300 MILLER20 FORD 3000 10875
20 3000 7875 SCOTT
20 JONES 2975 4875
20 1100 1900 ADAMS
20 SMITH 800 80030 2850 9400 BLAKE
30 1600 6550 ALLEN
30 1500 4950 TURNER
30 MARTIN 1250 3450
1250 2200 DISTRICT 30
30 JAMES 950 950
{code} -
Need help on rewriting query for the DOMAIN CONTEXT index
Hello
I'd be really grateful if someone could give me a tip how to rewrite the query so that the DOMAIN INDEX is executed as the last and not the first... According to the plan to explain it...
What I want: I want to index FIELD CONTAINS search for text ONLY for ITEMS that are extracted from the inner query (table MS_webarticlecache)...
Because it seems now DOMAIN INDEx is executed first on all the MS_ARTICLE table and then filtered by inner query ID's...
This query execution time is now around 86seconds... Inner query has all the indexes for SID_SUBCLIPPING and DATE_ARTICLE... (seen in line 3 of explain plan) If this one is fast and returns the unique id by grouping it and concating keywords...
Without text... search results are retrieved in 3 seconds...
DOMAIN index is created with Oracle 11 g FILTER BY ID, ART_DATE... and is on the MS_ARTICLE table and the ORATEXT seen on the sql column...
Table MS_ARTICLE has 1.8mil lines...
MS_WEBCACHEARTICLE table has cca. 2 lines of millet
SQL:
SELECT A.*, B.KEYWORDS OF
MS_ARTICLE HAS
JOIN THE
(SELECT be, wm_concat (keywords) "KEY words" FROM MS_webarticlecache WHERE SID_SUBCLIPPING IN ('LEK', "KRKA") AND DATE_ARTICLE > = TRUNC(SYSDATE-400) AND DATE_ARTICLE < = TRUNC (SYSDATE) GROUP BY be) B
WE
A.ID = B.ID_ARTICLE AND CONTAINS (A.ORATEXT, 'IMMUNAL', 1) > 0
Here is explain plan:
Plan
SELECT STATEMENT ALL_ROWSCost: 1 K bytes: cardinality K 16: 237
1 FIELD INDEX INDEX (DOMAIN) PRESCLIP. ART_IDX cost: 120
TABLE 2 ACCESS BY INDEX ROWID TABLE PRESCLIP.MS_ARTICLE cost: cardinality K bytes: 5 775: 237
3 INDEX RANGE SCAN INDEX PRESCLIP. WEBCACHE_SUBCLIPDATE cost: cardinality 10: 964
TABLE ACCESS BY INDEX ROWID TABLE PRESCLIP.MS_WEBARTICLECACHE cost 4: 250 octets: 45 K cardinality: 931
5 INLIST ITERATOR
Cost of 6 HASH JOIN: 1 K bytes: cardinality K 16: 237
7 FILTER
GROUP 8 SORT BY cost: 1 K bytes: cardinality K 16: 237
Thank you very much for the help.
KrisNo, dbms_stats.gather_index_stats should be enough I think. From RECONSTRUCTION vs FULL - on rebuilding mode Oracle rebuilt just the table $I from scratch (it creates a temporary table, fills and then current exchanges and the new tables). It should be much faster that the FULL optimization, where the picture remains the same and only its content changes. The resulting table will be more compact, too.
-
SELECT * FROM (SELECT A.SSN, C.CLAIM_SEQ, A.FIRST, A.MID, A.LAST, C.CLAIM_DT, C.INSERT_DT, C.CLAIM_STAT,
RN C.ISSUE_CDE, B.UCX_UCFE, B.TRAPOSS, B.DUAPOSS, C.AGENT_ID, C.CONFNUM, ROWNUM
THE APPLICANT HAS, CLMTELIG B, UICLAIMS C
WHERE A.CLMT_SEQ = B.CLMT_SEQ AND B.CLMT_SEQ = C.CLMT_SEQ) HAS
WHERE A.RN > = 100 AND A.RN < = 200
If you need high-end of for example: 100 records I get them...
But when I add the date column insert in this query to get the same range
SELECT * FROM (SELECT A.SSN, C.CLAIM_SEQ, A.FIRST, A.MID, A.LAST, C.CLAIM_DT, C.INSERT_DT, C.CLAIM_STAT,
RN C.ISSUE_CDE, B.UCX_UCFE, B.TRAPOSS, B.DUAPOSS, C.AGENT_ID, C.CONFNUM, ROWNUM
THE APPLICANT HAS, CLMTELIG B, UICLAIMS C
WHERE A.CLMT_SEQ = B.CLMT_SEQ AND B.CLMT_SEQ = C.CLMT_SEQ) HAS
WHEN TRUNC (INSERT_DT) BETWEEN ' 01-AUG-09' AND '' 02-SEP-09
AND A.RN > = 100 AND A.RN < = 200
This 100 and 200 are actually the bind variable: p_range1 and: p_range2
rownum > =: p_range1 AND rownum < =: p_range2
The user can enter any beach, as he has 300 to 500 should get rownum between 300 and 500 records.
Any help is appreciated...
Thanks in advance...Hello
Use the analytical ROW_NUMBER function instead of ROWNUM.
For example:
SELECT * FROM ( SELECT A.SSN, C.CLAIM_SEQ, A.FIRST, A.MID, A.LAST , C.CLAIM_DT, C.INSERT_DT, C.CLAIM_STAT , C.ISSUE_CDE, B.UCX_UCFE, B.TRAPOSS, B.DUAPOSS, C.AGENT_ID , C.CONFNUM , ROW_NUMBER () OVER (ORDER BY ...) -- Use whatever column or columns you want AS rn FROM CLAIMANT A , CLMTELIG B , UICLAIMS C WHERE A.CLMT_SEQ = B.CLMT_SEQ AND B.CLMT_SEQ = C.CLMT_SEQ ) A WHERE TRUNC (INSERT_DT) BETWEEN '01-SEP-09' AND '02-SEP-09' AND A.RN BETWEEN :p_range1 AND :p_range2 ;
In the ORDER BY clause Analytics, put expressions that determine the order. You can use ASC or DESC after each expression as an ORDER BY in the query clause.
In the query that you have posted, rn has been affected in no particulare order. If that's what you really want, use a constant in analytics ORDER BY clause, like this:... , ROW_NUMBER () OVER (ORDER BY 0)
You must use an ORDER byclause with ROW_NUMBER.
If you really want to use ROWNUM, assign ROWNUM in a subquery (give it an alias like r_num), then to a query of great, have the State "WHERE the r_num BETWEEN: p_range1 AND: p_range2.
Note that you query can produce rewer 101 lines, before even the last page. In fact, it can produce no line. The condition in the main query "WHERE TRUNC (INSERT_DT) BETWEEN" is applied after that rn is assigned, so, although the 101 lines meet the requirement on the rn, they can all be excluded by the condition on insert_date. Move condition on insert_date in the subquery if you want to change this.
Moreover, it is a Request of Pagination .
Published by: Frank Kulash, 21 May 2010 14:39
Added example. -
Help required to query the fields of the shuttle to Table?
Hi Experts,
My needs:
1. According to the Ship Date query field, the item number should display in the console on the left.
2. Select some amendments point shuttle from left to right shuttle and press the button.
3. the article selected our and these details must display in the table.
Design:
1 created as query field (entry of Message text) shipping Date.
2 Shuttle, Shuttle flight beginning and footer (second query button).
3. the table that contains the article, Description, quantity, and manufacturing details no.
Question:
I created a shuttle, the creeping shuttle and the flight of footer, here I mentioned the VO attribute and discovers for the first query that takes place in shipping date and displays the item No.
By default (without question) the extension numbers is the display in the shuttle leading.
How to use the fields in the query of the shuttle. Its not that allows you to query the selected fields.
Help required:
I need to ship date, then the element of the request should appear in the console of leak, then I need to move some element not in the shuttle leading and click on the second button of the query.
All required according to the shipping date and the amendments point values (Selected in the shuttle leading) must display in the table.
Thank you
Corinne BertrandPass this date and form a condition, and re-run the LEADVO
Anne Marie
Maybe you are looking for
-
Function of dll to interface with struct in LabVIEW
Hello I have a function:
-
Hello I know that if I see a modem device in Device Manager, I can do a right click on it, go to properties, then click the Modem tab for the port com for this modem device number. But how can I do deactivation in Labview? I hope that I can search by
-
Where is the USB port on the printer 4500 hp envy all-in-one
Where is the USB port on the printer 4500 hp envy all-in-one
-
my monitor everything turned upright, I know not if a touch low by mistake. How the * I get it back to horizontal.
-
Inspiron M5030 black screen at startup
As the topic says, when I boot my dell Inspiron M5030, I just get a black screen, no beep and yes I have connected externally on a monitor without success. It was working fine a few days ago, I stopped and went to bed, got up the next day and it star