Query to separate the number and character

Hi,
I have the string like '1000xyza' and query should return 1000 only.
example data:
source string = '1000xyz'
output = 1000
source string = '1000 xyz'
output = 1000
I need to use this logic in trigger, and currently I'm checking character by character in for loop to get number and it is taking long time to execute.
Please suggest better way
Thanks for help
Thanks,
Vijay

maybe this will somehow help.
SQL> With virtual_table AS
  2    (Select '1000xyz' str From dual
  3     Union All
  4     Select  '1000 xyz' str From dual)
  5  select vt.str,
  6         trim(translate(vt.str,'1234567890 ',' ')) char_string,
  7         translate(vt.str,translate(vt.str,'1234567890',' '),' ') numbers
  8    from virtual_table vt;
STR      CHAR_STRING NUMBERS
1000xyz  xyz         1000
1000 xyz xyz         1000
SQL>

Similar Messages

  • How to separate the value and currency

    Hi Experts,
    We have data in report like this 12545EUR
                                                       24521DM
    Now our requirement is  separate the value and currency.
    Can anybody tell me what i do in Query designer.
    Thanks in Advance

    Hi
    NODIM is used in a scenario like u want find the amount of product then the formula for the amount is price * quantity
    AMOUNT = PRICE * QUANTITY
    IN this case the unit for PRICE ,let say EUR and for quantity the unit is EA and say we have price value = 10 EUR and quantity value   = 5 EA
    if u apply the above value in the above formula , then it leads to the value as shown below,
    AMOUNT = 10 EUR * 5 EA = 50 EUR EA
    In this case the units for the amount should be EUR not "EUR EA" in this case we have to eliminate the units for PRICE . so that can be done by using the
    amount = /BIC/NI_AMT * NODIM(/BIC/NI_QTY)
                 = 10 EUR       *   5         = 50 EUR
    Hope u got it,
    Revert back in case of any query ,
    Assign points ,
    Thanx & Regads,
    raviChandra

  • Which method to count the number of character in a string?

    Hi all,
    I want to know which class and method to count the number of character in a string?
    Gary

    http://java.sun.com/j2se/1.4.2/docs/api/java/lang/String.html

  • I've got an iPad and iPhone 4S, both of which are set up for facetime. When someone calls me, both the iPad and phone ring, even though the phone is set to receive facetime calls on the number and the iPad is set for an email account. why is this?

    I've got an iPad and iPhone 4S, both of which are set up for facetime. When someone calls me, both the iPad and phone ring, even though the phone is set to receive facetime calls on the number and the iPad is set for an email account.
    How can I change the setup so on the email only the iPad rings and on the phone number only the phone rings?

    No it's not stealing. They have an allowance that you can share with so many computers/devices. You'll have to authorize her computer to play/use anything bought on your acct. You can do this under the Store menu at top when iTunes is open on her computer.
    As far as getting it all on her computer....I think but I am not sure (because I don't use the feature) but I think if you turn on Home Sharing in iTunes it may copy the music to her computer. I don't know maybe it just streams it. If nothing else you can sign into your acct on her computer and download it all to her computer from the cloud. Not sure exactly how to go about that, I haven't had to do that yet. I wonder if once you authorize her computer and then set it up for automatic downloads (under Edit>Preferences>Store) if everything would download. Sorry I'm not much help on that.

  • How can I determine the number and sizes of redologs?

    Dear all,
    How can I determine the number and sizes of redologs are sufficient to allow redo log switching while hot backup is in progress?
    Please advice,
    Amy

    Two questions here - what the OP put as the subject title and what was asked in the thread, which are different questions.
    I would interpret the question in the thread to mean "how to avoid hanging due to archiving waiting for a redo log group to become available." Alert log, wait events, and user complaints would be the source of information here.

  • Query to retrieve the number of transactions done in every 1 hour for last

    Hi,
    Could anyone help in writing a query to retrieve the number of transactions done in every 1 hour for last month.
    Case:
    I/P
    Cases Timestamp1
    case1 01-01-2008 00:00:01
    case2 01-01-2008 00:01:01
    case3 01-01-2008 01:00:01
    case1 01-01-2008 01:02:01
    case4 01-01-2008 01:10:01
    case5 02-01-2008 02:00:01
    case6 02-01-2008 02:10:01
    case7 02-01-2008 23:00:01
    case.. 31-01-2008 24:00:00
    O/P
    from time to_time cases
    01-01-2008 00:00:00 01-01-2008 01:00:00 2
    01-01-2008 01:00:01 01-01-2008 02:00:00 3
    etc
    Any help really appreciated

    We can do this using analytical functions
    Following is what I did:
    create table timestamp1 (ts date)
    select *from timestamp1
    30/10/2008 15:41:13
    30/10/2008 15:41:05
    30/10/2008 15:40:03
    30/10/2008 14:58:26
    30/10/2008 14:29:45
    30/10/2008 13:17:48
    30/10/2008 08:29:50
    30/10/2008 06:05:51
    30/10/2008 03:41:52
    30/10/2008 02:29:54
    select distinct to_char(ts,'hh24') frmhrs,
    to_char(ts,'hh24')+1 tohrs, count(ts) OVER (order by to_number(to_char(ts,'hh24')) RANGE (1/24) PRECEDING )
    from timestamp1
    where trunc(ts)=trunc(sysdate) -- I added this just to make sure I get for today's data
    order by frmhrs
    FRMHRS     TOHRS     CNT
    02     3     1
    03     4     1
    06     7     1
    08     9     1
    13     14     1
    14     15     2
    15     16     3
    You can customizeas per ur need.

  • Query to track the holder and waiter info

    Hi All,
    I have framed the following query to get the blocker and holder info.
    I intend to use this query in a auto-generated mail which executes every 15 mins
    I have put an outer join on the holder because the holder DML might have completed its execution (v$sqlarea might not have info about this holder DML) at the time the auto mail configuration fires this query
    I am not a dba and was apprehensive if there is some mistake in the logic of my query.
    I was also expecting to join v$sql_bind_capture using sql_hash_value and sql_address just the way in which I have joined v$sqlarea
    Looking forward to your kind help in vetting the below query
    Select distinct waiting_session,
    dba_waiters.holding_session,
    decode(to_char(session_waiting_info.STATE),'0','waiter is currently waiting','-2','duration of last wait by waiter is unknown','-1','waiter waited for a short time',' waiter waited long time') "waiters waiting state",
    decode(session_waiting_info.WAIT_TIME,0,'waiter waiting') "waiters last wait time",
    decode(to_char(session_holding_info.STATE),'0','holder is currently waiting','-2','duration of last wait by holder is unknown','-1','holder waited for a short time','holder waited long time') "holders waiting state",
    decode(session_holding_info.WAIT_TIME,0,'waiter waiting') "holders last wait time",
    sql_waiting_info.sql_text "query of the waiter",
    sql_holding_info.sql_text "query of the holder",
    session_waiting_info.STATUS "waiting STATUS",
    session_holding_info.STATUS "holding STATUS",
    session_waiting_info.process "waiting process",
    session_waiting_info.PROGRAM "waiting PROGRAM",
    session_holding_info.process "holding process",
    session_holding_info.PROGRAM "holding PROGRAM",
    session_waiting_info.ROW_WAIT_OBJ# "waiting object",
    session_waiting_info.ROW_WAIT_ROW# "waiting row",
    session_holding_info.ROW_WAIT_OBJ# "holding object",
    session_holding_info.ROW_WAIT_ROW# "holding row",
    session_waiting_info.BLOCKING_SESSION_STATUS "waiting session status",
    session_holding_info.BLOCKING_SESSION_STATUS "holding session status",
    session_waiting_info.username "holding os username",
    session_holding_info.username "waiting os username",
    session_waiting_info.MACHINE "waiting MACHINE",
    session_waiting_info.TERMINAL "waiting TERMINAL",
    session_holding_info.MACHINE "holding MACHINE",
    session_holding_info.TERMINAL "holding TERMINAL",
    session_waiting_info.TYPE "waiting TYPE",
    session_holding_info.TYPE "holding TYPE"
    from dba_waiters,
    v$session session_holding_info,
    v$session session_waiting_info,
    v$sqlarea sql_waiting_info,
    v$sqlarea sql_holding_info
    Where dba_waiters.waiting_Session = session_waiting_info.sid
    and dba_waiters.holding_Session = session_holding_info.sid
    And session_waiting_info.sql_hash_value = sql_waiting_info.hash_value
    And session_waiting_info.sql_address = sql_waiting_info.address
    and session_holding_info.sql_hash_value = sql_holding_info.hash_value(+)
    And session_holding_info.sql_address = sql_holding_info.address(+)
    and dba_waiters.mode_held 'None'
    Regards,
    Vishal

    Hi Jonathan,
    I have tried to incorporate your suggestions in the below query. Please let me know about the problems that the below query suffers from
    select session_waiting_info.BLOCKING_SESSION,
         waiter.sid waiting_session,
         waiter.SECONDS_IN_WAIT,
         decode(session_holding_info.STATE,'WAITED SHORT TIME','Holder did not wait and is currently '||session_holding_info.STATUS,'WAITING','Holder is also waiting for the past '||session_holding_info.SECONDS_IN_WAIT ||' seconds','WAITED UNKNOWN TIME','Duration of last wait of holder is unknown','WAITED KNOWN TIME','Duration of last wait by the holder is:'||session_holding_info.STATE || ' and is currently '||session_holding_info.STATUS) "State of holder",
         sql_waiter_info.SQL_TEXT,
         bind_values.NAME,
         bind_values.VALUE_STRING,
         session_waiting_info.STATUS "waiting STATUS",
    session_waiting_info.username "holding os username",
    session_holding_info.username "waiting os username",
    session_waiting_info.STATUS "waiting STATUS",
    session_waiting_info.process "waiting process",
    session_holding_info.process "holding process",
    session_waiting_info.PROGRAM "waiting PROGRAM",
    session_holding_info.PROGRAM "holding PROGRAM",
    session_waiting_info.ROW_WAIT_OBJ# "waiting object",
    session_waiting_info.ROW_WAIT_ROW# "waiting row",
    session_holding_info.ROW_WAIT_OBJ# "holding object",
    session_holding_info.ROW_WAIT_ROW# "holding row",
         session_waiting_info.sql_id,
         session_waiting_info.SQL_CHILD_NUMBER
    from V$SESSION_WAIT waiter,
         V$SESSION session_holding_info,
         V$SESSION session_waiting_info,
         V$SQLSTATS sql_waiter_info,
         V$SQL_BIND_CAPTURE bind_values
    where waiter.sid = session_waiting_info.sid
    and session_waiting_info.BLOCKING_SESSION = session_holding_info.sid
    and session_waiting_info.sql_id = sql_waiter_info.sql_id
    and session_waiting_info.sql_id = bind_values.sql_id(+)
    and session_waiting_info.SQL_CHILD_NUMBER = bind_values.CHILD_NUMBER(+)
    and waiter.WAIT_TIME = 0
    Regrds,
    Vishal

  • Query to get the blocker and holder info

    Hi All,
    I have framed the following query to get the blocker and holder info.I intend to use this query in a auto-generated mail which executes every 15 mins
    I have put an outer join on the holder because the holder query might have been executed at the time the auto mail configuration fires this query
    I am not a dba and was apprehensive is there is some mistake in the logic of my query. I was also expecting to join v$sql_bind_capture using sql_hash_value and sql_address just the way in which I have joined v$sqlarea
    Looking forward to your kind help in vetting the below query
    Select distinct waiting_session,
    dba_waiters.holding_session,
    decode(to_char(session_waiting_info.STATE),'0','waiter is currently waiting','-2','duration of last wait by waiter is unknown','-1','waiter waited for a short time',' waiter waited long time') "waiters waiting state",
    decode(session_waiting_info.WAIT_TIME,0,'waiter waiting') "waiters last wait time",
    decode(to_char(session_holding_info.STATE),'0','holder is currently waiting','-2','duration of last wait by holder is unknown','-1','holder waited for a short time','holder waited long time') "holders waiting state",
    decode(session_holding_info.WAIT_TIME,0,'waiter waiting') "holders last wait time",
    sql_waiting_info.sql_text "query of the waiter",
    sql_holding_info.sql_text "query of the holder",
    session_waiting_info.STATUS "waiting STATUS",
    session_holding_info.STATUS "holding STATUS",
    session_waiting_info.process "waiting process",
    session_waiting_info.PROGRAM "waiting PROGRAM",
    session_holding_info.process "holding process",
    session_holding_info.PROGRAM "holding PROGRAM",
    session_waiting_info.ROW_WAIT_OBJ# "waiting object",
    session_waiting_info.ROW_WAIT_ROW# "waiting row",
    session_holding_info.ROW_WAIT_OBJ# "holding object",
    session_holding_info.ROW_WAIT_ROW# "holding row",
    session_waiting_info.BLOCKING_SESSION_STATUS "waiting session status",
    session_holding_info.BLOCKING_SESSION_STATUS "holding session status",
    session_waiting_info.username "holding os username",
    session_holding_info.username "waiting os username",
    session_waiting_info.MACHINE "waiting MACHINE",
    session_waiting_info.TERMINAL "waiting TERMINAL",
    session_holding_info.MACHINE "holding MACHINE",
    session_holding_info.TERMINAL "holding TERMINAL",
    session_waiting_info.TYPE "waiting TYPE",
    session_holding_info.TYPE "holding TYPE"
    from dba_waiters,
    v$session session_holding_info,
    v$session session_waiting_info,
    v$sqlarea sql_waiting_info,
    v$sqlarea sql_holding_info
    Where dba_waiters.waiting_Session = session_waiting_info.sid
    and dba_waiters.holding_Session = session_holding_info.sid
    And session_waiting_info.sql_hash_value = sql_waiting_info.hash_value
    And session_waiting_info.sql_address = sql_waiting_info.address
    and session_holding_info.sql_hash_value = sql_holding_info.hash_value(+)
    And session_holding_info.sql_address = sql_holding_info.address(+)
    and dba_waiters.mode_held <> 'None'
    Regards,
    Vishal
    Edited by: user11924113 on Feb 18, 2011 2:39 AM

    Query to track the holder and waiter info
    People who reach this place for a similar problem can use the above link to find their answer
    Regards,
    Vishal

  • I can't seem to make n actual phone call from my phone.  I dial the number, and at the other end it rings, and the person knows it is me trying to call... but on my end of the phone is nothing at all.  Why is that?

    I can't seem to make an actual phone call from my iPhone 4S.  I dial the number, and the phone at the other end rings.  But at my end there is nothing.  No ringing.  No person trying to talk to me.  What is causing this problem?  I have got all of the current updates loaded to my phone.

    My brother had a similar problem and he went to the Apple store and they gave him a new one under warrenty...she said something about the arial, I would give it a go.

  • How to separate the source and the measured current

    Hi Everybody,
    I'd like to know if there is some way to separate the source and the measured current and just writte an mathematical expression to make a dependence between the source and the said parameter. Thanks in advance.

    Sure,
    Here is the deal:
    I'd like to build a circuit with dependent sources, but instead of connecting the sense of current/voltage, I'd like to know if there is a way to writte a sentence for the source which is dependent of a parameter.
    For example:
    In this circuit I just wrote an expression for the source and its respective parameter. (8*Io).
    Attachments:
    images.jpg ‏7 KB

  • HT5556 Hi ! I have a problem whit my iTunes card . I scratch the cod but is been of also the number and letter so I can't activate any more that card . Can you help me please to find the good code . Thank you

    Hi ! I have a problem whit my iTunes card . I scratch the cod but is been of also the number and letter so I can't activate any more that card . Can you help me how to fiind the good code  please  Thank you

    Click here and request assistance, supplying as much of the code as you can.
    (74543)

  • Query to find the Views and synonyms that are accessing through db_link

    HI all,
    Oracle 10g
    I need a Query to find the Views and synonyms that are accessing through db_link.
    ie.
    database A have the db_link to database B through a schema A
    now i need to find what are the Synonyms and views that are accessing through db_link either directly or indirectly..
    regards,
    Deepak
    Edited by: Deepak_DBA on Dec 10, 2010 5:38 PM

    On the second database (B) use this query to find the SQL which used by the schema A (DB LINK USER). Check the SQL_FULLTEXT column.
    select sql_fulltext,sql_id,module,parsing_schema_name,parsing_user_id,first_load_time,loads,users_executing,rows_processed,plsql_exec_time,sorts,fetches,invalidations,parse_calls,cpu_time,elapsed_time,disk_reads,buffer_gets
    from V$sqlarea
    where parsing_schema_name = 'A' --and to_char(first_load_time,'dd/mm/yyyy') like  '%11/08/2007'
    order by first_load_time desc;
    Regards
    Asif Kabir

  • My samsung stratosphere is very slow to place a call.  I input the number and push CALL.  Nothing happens.  I try it again and nothing happens.  Then some time later (2-5 mins) the phone goes ahead and dials.  What is causing this delay in dialing?

    my samsung stratosphere is very slow to place a call.  I input the number and push CALL.  Nothing happens.  I try it again and nothing happens.  Then some time later (2-5 mins) the phone goes ahead and dials.  What is causing this delay in dialing.

    wadams5641,
    Let's add some speed to your service and ensure you can make calls without the
    delay. When was the last time you turned off your phone? Is the software up to
    date?
    KarenC_VZW

  • For some reason my phone is using another number and won't let me delete the number and select my own numbers. Any reasons why

    For some reason my phone is using another number and won't let me delete the number and select my own numbers. Any reasons why

    Are you talking about iMessage?

  • HT4623 I received a ticket iOS diagnostics ticket number 72181, however every time i press quick test. It says the ticket number was not found. Verify the number and try again. But that the ticket number i received.

    I received a ticket iOS diagnostics ticket number 72181, however every time i press quick test. It says the ticket number was not found. Verify the number and try again. But that the ticket number i received.

    I have never read so much information. There is no charge to change your cell number. However only the account holder can log in to My Verizon Web Portal http://www.verizonwireless.com and click on her second line (your phone should be shown)
    I cannot fathom unless your sister gave you account access the ability to pay each line separately.
    Just pay your sister and have her pay the complete invoice when due. Problem solved.
    You could also to an assumption of liability on that second line on your sisters account. Call *611 or 1-800-922-0204 and make sure your sister is right there with you to do this. Then the line comes off her account and you can then set up your own account with verizon.
    You can also switch to T-Mobile now and they will pay off that early termination fee and give credit for your old verizon device, but you have to buy a new phone over time payments from T-Mobile. Please note a hard credit check will be done by verizon if you break off of your sisters account for one of your own, and T-Mobile also does a hard credit check before they provide service. http://www.T-Mobile.com
    Good Luck

Maybe you are looking for