REGEXP_LIKE statement help
Hello ExpertsI have a little problem to solve the problem with REGEXP_LIKE as shown below.
All records are giving me the result desired, except the last in alph and digital and between the two spaces.
Can I please have the solution please. I tried with INSTR, but it does not work too.
Thanks in advance
Rajesh
WITH T AS
(SELECT '$000 444 888' STUDENT_ID FROM DUAL UNION ALL)
SELECT ' ^ ^ ^ ' STUDENT_ID FROM DUAL UNION ALL
SELECT "ABCDEFGH &' DOUBLE UNION ALL STUDENT_ID"
SELECT '! @ ' STUDENT_ID FROM DUAL UNION ALL
SELECT ' 123456 * 891' STUDENT_ID FROM DUAL UNION ALL
SELECT "AAA 77BBBBB" DOUBLE STUDENT_ID
)
SELECT student_id FROM T
IF not REGEXP_LIKE (trim (STUDENT_ID), ' ^ [[: alnum:]] * $')
Rb2000rb65 wrote:
Any help on this please.
You won't get much help unless you clearly explain the issue. Sven W. gave you the solution:
IF not REGEXP_LIKE (STUDENT_ID, ' ^ [[: alnum:]] * $"")
SQL> WITH T AS
2 (SELECT '000 444$888' STUDENT_ID FROM DUAL UNION ALL
3 SELECT '^^^^^^^^^^ ' STUDENT_ID FROM DUAL UNION ALL
4 SELECT 'ABCDEFGH&' STUDENT_ID FROM DUAL UNION ALL
5 SELECT '!@@@@@@@ ' STUDENT_ID FROM DUAL UNION ALL
6 SELECT '123456*891 ' STUDENT_ID FROM DUAL UNION ALL
7 SELECT 'AAA 77BBBBB ' STUDENT_ID FROM DUAL
8 )
9 SELECT student_id FROM T
10 WHERE not REGEXP_LIKE(trim(STUDENT_ID), '^[[:alnum:] ]*$')
11 /
STUDENT_ID
------------
000 444$888
^^^^^^^^^^
ABCDEFGH&
!@@@@@@@
123456*891
SQL>
So if it's still not good for you, you need to explain why.
SY.
Tags: Database
Similar Questions
-
DBA dear friends,
In my 11.1.0.7 database, I have an ID of SQL which contributes about 100 reads physical Mil a day in the database, he ran 85 times in the 24 hour period.
Here is the SQL - it accesses the SYSTEM tables and EM monitors query type, and is not a request part of the application-
Dictionary collection stats help reduced the physical reads? Or any other point of view that what must be considered?
Is it still worth to try tuning the query? Please share your entries...
SELECT 'AQ_Messages_in_Expired' t. *
Of
(select q. owner | | '.' | | q . name , v. expired
de v$aq v, dba_queues q
où v. QID = q. QID and q. owner not in ('SYS','SYSTEM','WMSYS') and q. QID not in (206397, 206398, 206325)) tI don't see a MERGE JOIN CARTESIAN, which is good. I do not see a stage for fixed table and it MIGHT help generate fixed objects statistics:
exec dbms_stats.gather_fixed_objects_stats (null)
You can see if they have been already generated by querying the SYS. TAB_STATS$:
Select count (*) in the sys.tab_stats$;
If it is empty then stats fixed objects have not been met. Stats of $ service must be collected by the work of database statistics 'standard '. You can collect these stats and run the query again to see if the run time is improving. You can also check when the last statistics, what are the sample sizes and how closely NUM_ROWS agrees with a count (*) current tables questioned.
David Fitzjarrell
-
Thanks in advance for your help. I work on a PDF form and has difficulty with a logical statement (If Then). Then the field (TotalEligibleServiceCatchup) should be the least of the three amounts: TotalElectiveSalaryDeferralMinusYearsOfServiceCatchup, LifetimeMinusCatchupAmount, or $3,000. In other words, if the Total salary deferral less years of Service catch-up is like $3,000 and life less amount of catch-up is greater than $3,000; the value of the calculated field is $ 3,000. If one or both of the first two values are less than $3,000, the calculated field is the least of these values.
Thanks in advance for your help.
In this case, you can use this code as the custom of your domain calculation script:
var v1 = +this.getField("TotalElectiveSalaryDeferralMinusYearsOfServiceCatchup").valueAsString; var v2 = +this.getField("LifetimeMinusCatchupAmount").valueAsString; event.value = Math.min(3000, v1, v2);
-
SQL statement Help Find County
I have an Oracle table with lot of columns and I want to check if 3 of my columns contain all values (I don't like the real value, there, I just want to know how many of them have a value). Allows so say for example:
Table columns: ID, A, B, C
These conditions would be true... value exists in both A AND B, A AND C or B AND C columns. If a value exists in A and not B or C, then it should not be counted. Similarly, if a value exists in B and not A or C, or there is a value C and not A or B, then he shouldn't have counted.
----------------------
| ID | A | B | C |
----------------------
| 1. X | X | | <-true
| 1. X | X | X | <-true
| 1. X | | X | <-true
| 1 | | X | X | <-true
| 1. X | | | <-false
| 1 | | X | | <-false
| 1 | | | X | <-false
| 1 | | | | <-false
| 2. X | X | | <-true
| 2. X | X | X | <-true
| 2. X | | X | <-true
| 2 | | X | X | <-true
| 2. X | | | <-false
| 2 | | X | | <-false
| 2 | | | X | <-false
| 2 | | | | <-false
----------------------
Static values will be my ID. I want to check against 2 ID who I know will always be the case. I tried to write, but I'm sure I'm doing something wrong because my count was very high (about 1.7 million records over 2 million).
That's what I wrote:
Select count (*)
FROM table1
where (ID = "1" or ID = "2")
(A is not null and B is not null)
or (A is not null and is not null)
or (B is not null and is not null);
Thanks for your help!
Published by: 973560 on March 14, 2013 12:03Hello
One way to see how many rows have values in at least 2 of the following columns:
SELECT COUNT (*) AS cnt FROM table1 WHERE id IN ('1', '2') -- is id really a string? AND NVL2 (a, 1, 0) + NVL2 (b, 1, 0) + NVL2 (c, 1, 0) >= 2 ;
I hope that answers your question.
If not, post a small example data (CREATE TABLE and only relevant columns, INSERT statements) and also publish outcomes from these data.
Point where the above query is to produce erroneous results, and explain, using specific examples, how you get the right results from data provided in the palces.
Always say what version of Oracle you are using (for example, 11.2.0.2.0).
See the FAQ forum {message identifier: = 9360002} -
Get-stat, help to understand what he gives me!
Hello
I'm playing with get-stat so that I can make a series of simple tests to see how a host server to load changes when virtual machines are added (and load simulated on these virtual machines).
I'm a little confused as to what I mean really get stat. basically, I want to make a sample of five minutes, then add more machines and make a five minute sample etc.
I use the parameter intervalssecs the value 5 and get statistics for every 20 seconds. What I understand as the period nearest available range, so it's well and good, but the maxsamples confuses me.
Here is an example of code that I use.
Get stat - entity & lt; vmhost & gt; -Start (get-date).addhours(-1) - cpu.usage.average stat - intervalsecs 5 - maxsamples 2
Now, I think this list 2 samples twenty seconds (when I make it work with a second 300 range it just 2 samples list) but what I get is indeed 10 samples as shown below:
MetricId Timestamp value unit
-
-
-
-
CPU.usage.Average 2009-08-19 09:19:54 3.61%
CPU.usage.Average 2009-08-19 09:19:34 2.06%
CPU.usage.Average 2009-08-19 09:19:54 8.5%
CPU.usage.Average 2009-08-19 09:19:34 1.37%
CPU.usage.Average 2009-08-19 09:19:54 1.08%
CPU.usage.Average 2009-08-19 09:19:34 2.38%
CPU.usage.Average 2009-08-19 09:19:54 2.71%
CPU.usage.Average 2009-08-19 09:19:34 3.28%
CPU.usage.Average 2009-08-19 09:19:54 2.14%
CPU.usage.Average 2009-08-19 09:19:34 1.19%
What I don't understand is:
1. Why is the list 10 samples?
2. why the samples with the same timestamp have different values?
I'm obviously not or do not understand something here.
Please could someone help me understand.
Thank you
Roger
I sense that you have 4 cores of the processor on the ESX Server.
More seriously, I'm not psychic, but returns the cpu.usage.average metric:
-1 value by heart
-1 overall value
Up to 2 times 5 is 10 samples.
If you include the Instance property on your exit, you will see this.
Note that the overall value has an empty Instance property, while the other 4 have the kernel # in this property.
get-stat -entity
-start (get-date).addhours(-1) -stat cpu.usage.average -intervalsecs 5 -maxsamples 2 | select * -
I am an Oracle DBA being thrown in the java world, and I'm having some trouble with an if statement. I need produce a tag that looks like this:
1 customer name
3 address line 1
4 address line 2
5, Zip City State
6 countries
It is possible that the lines 4 and 6 have all the data. So in this case, I don't want to print these lines.
My if statement is less. It works as long as there are data in 4. If 4 is null then I get no results at all. Any suggestions how to fix this code?
Thank you!
{
If (4! = null) {}
If (6! = null) {}
var text = '1,3,4,5,6' ;}
else if (6 is null) {}
var text = '1,3,4,5' ;}
ElseIf (6! = null) {}
var text = "1,3,5,6." }
else {}
var text = "1,3,5" ;}
}Hi sharonkovac,
Since your outermost status is "if (4!" (= null)"all the logic is procesed only when 4 is different from null.
Code indentation can help to better understand the logic.{if(6==null)}
if(4!=null) {text = '1,3,4,5' ;}
else {text = "1,3,5" ;}
}
if(4!=null) Else {text = '1,3,4,5,6' ;}
else {text = "1,3,5" ;}Best reggards,
-
Otherwise, if the statement help
Well I'm well enough to the 'if' statement and the "else" statement as well. But what do I do if I need 2 conditions to be met before that nothing is done in my form. I'll do my best to explain what it is I'm doing.
I want radio2 to change its value to 2 when radio1 has a value of 2. But radio1 runs a different calculation of numericfield1 then radio2 made in numericfield2.
Basically what I do is to design a guide to estimate for a flooring company. (Working on the carpet now section) Problem is that the carpet is available in 2 different widths. large carpet 12 and 15 wide carpet. Most of my customers don't know what width of carpet they will choose when I am at home to measure for carpet. So I was preaching different estimates for each. But rather than filling an entire form for 15 carpet wide, I want simple selections as if or not move us furniture or pulling automatically out carpets to be filled in the section 15 of width of the estimate that I answer the questions in section 12 wide. But here's the catch. Some of my clients are 100% sure that they choose 12 wide carpet (or scale 15 incidentally). If I don't want the calculations made, unless a check box has been checked if it does not confuse my customers. Thanks for any help
Sorry, now I see:
this.rawValue = cost15wide.rawValue * qty15wide.rawValue;
You must .rawValue when accessing the value of the objects.
Hope that works,
Niall
-
REGEXP_LIKE sql help...
I have a first_name column in my table of students with the following characteristics:
REDA
Kris
Tanvi
Shweta
Rajendra
Kapil
Vipin
Sandeep
Now I'm trying to use the regexp_like function to find the names that begin the letter s and end with the letter p, but I am not able to achieve that I provided here my request please help:
Select first_name
the student
where regexp_like (name, ' ^ sp$ ');
Concerning
RahulMac_Freak_Rahul wrote:
where regexp_like (name, ' ^ sp$ ');Describe your regular expression is to find the string "sp". You do not include buildings for characters that could go p and between s. Here is an example that may help:
SQL> WITH student AS 2 ( 3 SELECT 'raj' AS first_name FROM dual UNION ALL 4 SELECT 'kris' AS first_name FROM dual UNION ALL 5 SELECT 'tanvi' AS first_name FROM dual UNION ALL 6 SELECT 'shweta' AS first_name FROM dual UNION ALL 7 SELECT 'rajendra' AS first_name FROM dual UNION ALL 8 SELECT 'kapil' AS first_name FROM dual UNION ALL 9 SELECT 'vipin' AS first_name FROM dual UNION ALL 10 SELECT 'sandeep' AS first_name FROM dual 11 ) 12 SELECT first_name 13 FROM student 14 WHERE REGEXP_LIKE(first_name,'^s.*p$') 15 ; FIRST_NA -------- sandeep
-
Formatting state help - too much space empty
How can I get rid of the extra between the lines spaces when I delete the lines with missing data. I tried surprising empty data lines between text lines, if the line above the void is null or missing, but that does not work. Thanks for any help.Hello
You see this in the preview of the EN studio or in the HTML / PDF report output in the workspace or both? I had problems before with the preview of the Studio EN not reflecting not formatting that you see when you actually run the report using the workspace.
Have you tried to add text in the blank lines to make sure they are be deleted?
If it's problems then is it worth trying to insert lines formulas instead and see if it works better, if it is text lines that are giving you the problem.
Just some thoughts...
Stuart
-
Switch statements: help body_txt. !
http://ImageShack.us/a/img401/4206/Ipan.PNG
http://ImageShack.us/a/img20/7136/y7gm.PNG
___
var body_txt:TextField = new TextField();
body_txt.x = 225;
body_txt.y = 300;
body_txt. AutoSize = TextFieldAutoSize.LEFT;
var myFormat:TextFormat = new TextFormat();
var yourCategory:String;
yourCategory = category_txt.text;
Switch (yourCategory) {}
case 1:
trace ("74-95 mph 64-82 kt or 119-153 km/h");
break;
case 2:
trace ("96-110 mph 83-95 kt or 154-177 km/h");
break;
case 3:
trace ("111-130 mph 96-113 kt or 178-209 km/h");
break;
case 4:
trace ("131 to 155 mph or 114-135 kt or 210 - 249 km/hr");
break;
case 5:
trace ("greater than 155 mph 135 kt or 249 km/h.");
break;
by default:
trace ("unable to answer.");
}
yellow_btn.addEventListener (MouseEvent.Click, OnClick);
function onClick(event:MouseEvent):void {}
addChild (body_txt);
body_txt. "Text ="It is"+ category_txt +". » ;
}
___
As you can see, I get this message that says that "[the textfield]." It does not matter what I put in the body_txt., I get the same message (I also tried "is" + yourCategory + ".";).
My code is just fine without error, but not sure how to get the body_txt. to view one of the cases.
Thank you for your help.
use:
var body_txt:TextField = new TextField();
body_txt.x = 225;
body_txt.y = 300;
body_txt. AutoSize = TextFieldAutoSize.LEFT;
var myFormat:TextFormat = new TextFormat();
function categoryF(yourCategory:Number):void {}
Switch (yourCategory) {}
case 1:
trace ("74-95 mph 64-82 kt or 119-153 km/h");
break;
case 2:
trace ("96-110 mph 83-95 kt or 154-177 km/h");
break;
case 3:
trace ("111-130 mph 96-113 kt or 178-209 km/h");
break;
case 4:
trace ("131 to 155 mph or 114-135 kt or 210 - 249 km/hr");
break;
case 5:
trace ("greater than 155 mph 135 kt or 249 km/h.");
break;
by default:
trace ("unable to answer.");
}
}
yellow_btn.addEventListener (MouseEvent.Click, OnClick);
function onClick(event:MouseEvent):void {}
categoryF (number (category_txt.text));
addChild (body_txt);
body_txt. "Text ="It is"+ category_txt +". » ;
}
-
Confusion between Fix statement help
I can't understand what Fix instruction below trying to do. Can anyone help?
DIFFICULTY (@LIST (@Relative (@MEMBER (@CONCATENATE ("Station_", @SUBSTRING([CurrCompany],2))), 0), @Relative("Open Positions",0), @Relative ("new employees", 0), @Relative ('shared employees", 0)), 'No_Category', [CurrEntity], [CurrCompany], [CurrYear], [CurrVersion], [CurrProfitCenter], [CurrScenario])
ENDFIX
The @LIST, the @MEMBER, the @CONCATENATE are throwing me off the coast.
I think it is the concatenation 'Station_' with '416' of [CurrCompany] to get get the families of level 0 of the "Station_416"?
(But there is a surcharge) after the @Relative (' Shared employees,"0")) <-why is that? For the @LIST? Why does @LIST?
Known:
CurrCompany = S_416
Very confused...You have the right concatenation part.
I think that the @LIST is not necessary.
Kind regards
Cameron Lackpour
-
Hi all
In the table of audit_organizations_test, I want to delete all records except those returned returned in the following select statement:
How can I dial a delete statement to do this?select * from audit_organizations_test ao where last_updt_date >= '01-jan-2008' union select * from (select * from audit_organizations_test ao where org_id not in (select aoo.org_id from audit_organizations_test aoo where aoo.last_updt_date >= '01-jan-2008') ) x where x.last_updt_date = (select max(ao1.last_updt_date) from audit_organizations_test ao1 where x.org_id = ao1.org_id
Thank you.Hello
delete from audit_organizations_test where rowid not in (select rowid from audit_organizations_test ao where last_updt_date >= '01-jan-2008' union select * from (select * from audit_organizations_test ao where org_id not in (select aoo.org_id from audit_organizations_test aoo where aoo.last_updt_date >= '01-jan-2008') ) x where x.last_updt_date = (select max(ao1.last_updt_date) from audit_organizations_test ao1 where x.org_id = ao1.org_id )
Concerning
Anurag -
I am trying to create a query that returns the last date of order for the customer... the invoiced sales table contains a "calendar_id' I need to select the MAX, and then return the"activity_date"of the calendar table.
Here's what I have so far...
----------
SELECT
SALES. NATIVE_REPORTING_CUSTOMER_ID,
CUST. CLIENT_NAME,
CUST. SAP_CUSTOMER_NUMBER,
SALES_AREA. SALES_ORGANIZATION,
(select
DW. Calendar.activity_date
Of
DW. CALENDAR
where
DW. Calendar.calendar_id = Max (SALES. ORDER_CALENDAR_ID))
as MAX_ORDER_DATE
Of
DW. Sale INVOICED_SALES_FACT,
DW. CUST OF THE CUSTOMER,
DW. SALES_AREA
WHERE
SALES. NATIVE_REPORTING_CUSTOMER_ID = CUST. NATIVE_CUSTOMER_ID
AND SALES. SALES_AREA_ID = SALES_AREA. SALES_AREA_ID
AND CUST. CURRENT_FLAG = 'Y '.
AND SALES_AREA. SALES_ORGANIZATION IN ('ATS1', "ESS1")
GROUP BY
SALES. NATIVE_REPORTING_CUSTOMER_ID,
CUST. CLIENT_NAME,
CUST. SAP_CUSTOMER_NUMBER,
SALES_AREA. SALES_ORGANIZATION
----------
But I get the error
"Group feature is not allowed here."
which is of course related to the nested select statement I have the return date of the calendar table.
Pointers?
THXOf course, this should be better:
SELECT xyz.NATIVE_REPORTING_CUSTOMER_ID, xyz.CUSTOMER_NAME, xyz.SAP_CUSTOMER_NUMBER, xyz.SALES_ORGANIZATION, (select dw.calendar.activity_date FROM DW.CALENDAR where dw.calendar.calendar_id=xyz.MAX_SALES_ORDER_CALENDAR_ID) as MAX_ORDER_DATE FROM ( -- added this SELECT SALES.NATIVE_REPORTING_CUSTOMER_ID, CUST.CUSTOMER_NAME, CUST.SAP_CUSTOMER_NUMBER, SALES_AREA.SALES_ORGANIZATION, max(SALES.ORDER_CALENDAR_ID) as MAX_SALES_ORDER_CALENDAR_ID -- changed this FROM DW.INVOICED_SALES_FACT sales, DW.CUSTOMER CUST, DW.SALES_AREA WHERE SALES.NATIVE_REPORTING_CUSTOMER_ID=CUST.NATIVE_CUSTOMER_ID AND SALES.SALES_AREA_ID=SALES_AREA.SALES_AREA_ID AND CUST.CURRENT_FLAG='Y' AND SALES_AREA.SALES_ORGANIZATION IN ('ATS1','ESS1') GROUP BY SALES.NATIVE_REPORTING_CUSTOMER_ID, CUST.CUSTOMER_NAME, CUST.SAP_CUSTOMER_NUMBER, SALES_AREA.SALES_ORGANIZATION ) XYZ -- added this
Published by: Toon Koppelaars June 18, 2009 14:23
-
Hi, I'm doing a script for a submit by email button pick up two fields of the subject - an id and the date line. The problem is there are two date fields and I want only to pick up one of them. So if the first is empty (that is, "home_insert_date") he will get the second one (i.e. "apt_insert_date"), and if the first is filled, then it will ignore the other.
Here's the current code that I have.
var parts = getField("newspaper_flyerid").value + '-' + getField("home_insert_date").value + getField("apt_insert_date").value
this.mailDoc({)
cTo: " [email protected] ", "
bassujetti: parts,.
});Thank you very much!
Try this:
var part1 = this.getField("newspaper_flyerid").valueAsString; var part2 = this.getField("home_insert_date").valueAsString; var part3 = this.getField("apt_insert_date").valueAsString; var subjectLine = part1 + "-"; if (part2=="" && part3=="") { subjectLine += "missing date"; } else if (part2!="") { subjectLine += part2; } else subjectLine += part3; this.mailDoc({ cTo: "[email protected]", cSubject: subjectLine });
-
public var x: Object;
public var: value chain;value = G10;
If (value)
{
x = value;
If (x < G10)
{
Code here...
}
Why can't I write it like this "if (x < G10)"? ".Im trying to read a value from a microcontroller, which have the letter 'G' in front of a number. The code works if I only use numbers like this: If (x < 10).
Compiler will not accept it, comes up with this ERROR:
Several markers to this line:
-1120: access of undefined property G10.
-1 line changed
There are a few things wrong.
First of all,
value = G10;
must be enclosed in quotes if the G10 is really a string
value = "G10";
Otherwise the compiler will think it a variable undeclared.Then it's a value Boolean true / false
If (value)should be an audit of the chain
If (value! = null)
Then,.
x = value;
This is a value of an object to a string.
Could be
x.value = value;
And the last,
If (x<>
This is incorrect, as the less than sign to will not work
with ropes at least what them are a numeric value and utilization of parseFloat or parsInt to compareIt would be in the ball park.
If (x.value! = "G10")
If the two values were digital or you can use
If (parseFloat (x.value)<>
HTH
Maybe you are looking for
-
Transfer songs from Apple music from iPhone to iTunes
Hello world Most of my songs is downloaded directly from Apple music on my iPhone. I think that my iPhone and my PC is connected somehow through the same Apple ID Whenever I want to sync my songs from iPhone to iTunes on my PC, my PC already knew tha
-
Cannot complete the installation of the printer
I tried several ways but have been unable to install my printer, (Olivetti Boumat90 20) on this laptop. Tried to download the driver from site Internet Olivetti, but the download is not completed. Can anyone help? The printer worked perfectly with my
-
20 Bloggie and audio/video not synchronized
I just this 2 weeks ago and I want to make sure I know what I have in front of the store-back window expires... During playback of my videos, it's like a bad dubbing - move the mouth, and then a few seconds later his fate. Why is this? Something be a
-
15 - g066nl: enter the password administrator or power on password
I tried to get into the bios and I got this message. Now, I got this code: 62364255 Help, please
-
Buzzing sound when I plug earphones
Hi, I have an ideapad Y570 with HDD and SSD. When I plug the headphones or the speakers, I can hear a buzzing in the left channel. I went to fix it! Help me please! THX