How to sorting character +  numeric in oracle?

Please help to sort below String in Oracle.
BR 77002000 in Finance No. 66-1204, P-ZIP: 20260, SAccountNumber:1234
MR 13000 in Finance No. 48-2010, P-ZIP: 75019, SAccountNumber:N/A
MR 77050001 in Finance No. 66-1204, P-ZIP: 20260, SAccountNumber:N/A
MR 1302 in Finance No. 66-1204, P-ZIP: 20260, SAccountNumber:N/A
PI 130 in Finance No. 66-1204, P-ZIP: 20260, SAccountNumber:N/A
PI 6780 in Finance No. 66-1204, P-ZIP: 20260, SAccountNumber:N/A
Thanks.
John

2 examples
with strs as (
select 'BR 77002000 in Finance No. 66-1204, P-ZIP: 20260, SAccountNumber:1234' str from dual union all
select 'MR 13000 in Finance No. 48-2010, P-ZIP: 75019, SAccountNumber:N/A' from dual union all
select 'MR 77050001 in Finance No. 66-1204, P-ZIP: 20260, SAccountNumber:N/A' from dual union all
select 'MR 1302 in Finance No. 66-1204, P-ZIP: 20260, SAccountNumber:N/A' from dual union all
select 'PI 130 in Finance No. 66-1204, P-ZIP: 20260, SAccountNumber:N/A' from dual union all
select 'PI 6780 in Finance No. 66-1204, P-ZIP: 20260, SAccountNumber:N/A' from dual)
select str from strs
order by nlssort(str,'NLS_SORT=FRENCH')
select str from strs
order by substr(str,instr(str,':',-1),length(str)-instr(str,':',-1)) desc
some more
SELECT       str,REGEXP_substr ( str, '[[:digit:]]+',1)
FROM       strs
ORDER BY  REGEXP_substr ( str, '[[:digit:]]+',1)
STR     REGEXP_SUBSTR(STR,'[[:DIGIT:]]+',1)
PI 130 in Finance No. 66-1204, P-ZIP: 20260, SAccountNumber:N/A     130
MR 13000 in Finance No. 48-2010, P-ZIP: 75019, SAccountNumber:N/A     13000
MR 1302 in Finance No. 66-1204, P-ZIP: 20260, SAccountNumber:N/A     1302
PI 6780 in Finance No. 66-1204, P-ZIP: 20260, SAccountNumber:N/A     6780
BR 77002000 in Finance No. 66-1204, P-ZIP: 20260, SAccountNumber:1234     77002000
MR 77050001 in Finance No. 66-1204, P-ZIP: 20260, SAccountNumber:N/A     77050001
SELECT       str,REGEXP_substr ( str, '[[:digit:]-]+',1,2)
FROM       strs
ORDER BY  REGEXP_substr ( str, '[[:digit:]-]+',1,2)
STR     REGEXP_SUBSTR(STR,'[[:DIGIT:]-]+',1,2)
MR 13000 in Finance No. 48-2010, P-ZIP: 75019, SAccountNumber:N/A     48-2010
PI 6780 in Finance No. 66-1204, P-ZIP: 20260, SAccountNumber:N/A     66-1204
MR 1302 in Finance No. 66-1204, P-ZIP: 20260, SAccountNumber:N/A     66-1204
PI 130 in Finance No. 66-1204, P-ZIP: 20260, SAccountNumber:N/A     66-1204
BR 77002000 in Finance No. 66-1204, P-ZIP: 20260, SAccountNumber:1234     66-1204
MR 77050001 in Finance No. 66-1204, P-ZIP: 20260, SAccountNumber:N/A     66-1204Edited by: chris227 on 06.02.2012 11:18
Edited by: chris227 on 06.02.2012 11:23
Edited by: chris227 on 06.02.2012 11:23

Similar Messages

  • How to select a substring in oracle up to a more than one specific character

    How to select a substring in oracle up to a more than one specific character
    for ex : 121.051^NP: FAMILY PRACTICE  ( trim the values before ^ )
                121.051^*NP: FAMILY PRACTICE (trim the value before *).
    with below function I can only get rid of ^ , I want both the specific characters ^ and ^* to be removed at the same time.   
    SUBSTR(p.phys_sub_grp_2_desc,INSTR(p.phys_sub_grp_2_desc, '^') +1)

    Another option is to boldly replace 'em:
    SQL> with t as (
      2  select '121.051^NP: FAMILY PRACTICE' str from dual union
      3  select '121.051^*NP: FAMILY PRACTICE' from dual
      4  )
      5  --
      6  -- actuel query:
      7  --
      8  select substr( replace(str, '*')
      9               , instr(replace(str, '*'), '^')+1
    10               ) str
    11  from   t;
    STR
    NP: FAMILY PRACTICE
    NP: FAMILY PRACTICE
    2 rows selected.

  • How to convert character into numeric

    Pls suggest me how to convert character value into numeric value.

    If you are looking for some FM then
    USE
    CALL FUNCTION 'CHAR_NUMC_CONVERSION'
    EXPORTING
    INPUT = 0
    IMPORTING
    NUMCSTR =
    or use
    Sample code below:
    codeDATA: lv_chr(4) type c,
    lv_num type p.
    CALL FUNCTION 'MOVE_CHAR_TO_NUM'
    EXPORTING
    CHR = lv_chr
    IMPORTING
    NUM = lv_num
    EXCEPTIONS
    CONVT_NO_NUMBER = 1
    CONVT_OVERFLOW = 2
    OTHERS = 3.
    IF SY-SUBRC 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.[/code]
    or USE
    CONVERT_STRING_TO_INTEGER
    or USE THESE FMs
    MOVE_CHAR_TO_NUM
    C14W_CHAR_NUMBER_CONVERSION
    CHAR_NUMC_CONVERSION
    reward if helpful

  • How to wrap a view in oracle

    Does any one know how to wrap a view in Oracle, I know it is not possible, yet. Are there any third party software to wrap the logic in the view.
    Thanks,
    Sanjay

    Your best bet is to write a view that queries the source tables and contains any necessary business logic
    CREATE VIEW VBASE AS SELECT A.COLUMN_A FROM TABLE_1 A, TABLE_2 B, TABLE_3 C WHERE A.ID = B.ID AND B.ID = C.ID;
    create a view for exposure to the user that queries the base view.
    CREATE VIEW VSECURE AS SELECT COLUMN_B FROM VBASE;
    and grant privileges to VSECURE.
    GRANT SELECT ON VSECURE TO SECURE_USER;
    This will allow the user to see, query, and describe VSECURE without seeing the definition for VBASE.
    The advantage of the this approach is that the query engine can still push predicates down into the base view to optimize the performance or the query where as this is limited with the pipeline function and can become a tuning headache.
    eg.
    SQL> -----------------------------------------
    SQL> -- create some tables
    SQL> -----------------------------------------
    SQL> CREATE TABLE table_1(ID NUMBER, MESSAGE VARCHAR2(100))
    Table created.
    SQL> CREATE TABLE table_2(ID NUMBER, message2 VARCHAR2(100))
    Table created.
    SQL> CREATE TABLE table_3(ID NUMBER, message3 VARCHAR2(100))
    Table created.
    SQL> -----------------------------------------
    SQL> -- populate tables with some data
    SQL> -----------------------------------------
    SQL> INSERT INTO table_1
    SELECT ROWNUM,
    CASE
    WHEN MOD ( ROWNUM, 50 ) = 0 THEN 'HELLO there joe'
    ELSE 'goodbye joe'
    END
    FROM DUAL
    CONNECT BY LEVEL < 1000000
    999999 rows created.
    SQL> INSERT INTO table_2
    SELECT ROWNUM,
    CASE
    WHEN MOD ( ROWNUM, 50 ) = 0 THEN 'how are you joe'
    ELSE 'good to see you joe'
    END
    FROM DUAL
    CONNECT BY LEVEL < 1000000
    999999 rows created.
    SQL> INSERT INTO table_3
    SELECT ROWNUM,
    CASE
    WHEN MOD ( ROWNUM, 50 ) = 0 THEN 'just some data'
    ELSE 'other stuff'
    END
    FROM DUAL
    CONNECT BY LEVEL < 1000000
    999999 rows created.
    SQL> -----------------------------------------
    SQL> --create base view
    SQL> -----------------------------------------
    SQL> CREATE OR REPLACE VIEW vbase AS
    SELECT a.MESSAGE,
    c.message3
    FROM table_1 a,
    table_2 b,
    table_3 c
    WHERE a.ID = b.ID
    AND b.ID = c.ID
    View created.
    SQL> -----------------------------------------
    SQL> --create secure view using base view
    SQL> -----------------------------------------
    SQL> CREATE OR REPLACE VIEW vsecure AS
    SELECT MESSAGE,
    message3
    FROM vbase
    View created.
    SQL> -----------------------------------------
    SQL> -- create row type for pipeline function
    SQL> -----------------------------------------
    SQL> CREATE OR REPLACE TYPE vbase_row
    AS OBJECT
    message varchar2(100),
    message3 varchar2(100)
    Type created.
    SQL> -----------------------------------------
    SQL> -- create table type for pipeline function
    SQL> -----------------------------------------
    SQL> CREATE OR REPLACE TYPE vbase_table
    AS TABLE OF vbase_row;
    Type created.
    SQL> -----------------------------------------
    SQL> -- create package
    SQL> -----------------------------------------
    SQL> CREATE OR REPLACE PACKAGE pkg_getdata AS
    FUNCTION f_get_vbase
    RETURN vbase_table PIPELINED;
    END;
    Package created.
    SQL> -----------------------------------------
    SQL> -- create package body with pipeline function using same query as vbase
    SQL> -----------------------------------------
    SQL> CREATE OR REPLACE PACKAGE BODY pkg_getdata AS
    FUNCTION f_get_vbase
    RETURN vbase_table PIPELINED IS
    CURSOR cur IS
    SELECT a.MESSAGE,
    c.message3
    FROM table_1 a,
    table_2 b,
    table_3 c
    WHERE a.ID = b.ID
    AND b.ID = c.ID;
    BEGIN
    FOR rec IN cur
    LOOP
    PIPE ROW ( vbase_row ( rec.MESSAGE, rec.message3 ) );
    END LOOP;
    END;
    END pkg_getdata;
    Package body created.
    SQL> -----------------------------------------
    SQL> -- create secure view using pipeline function
    SQL> -----------------------------------------
    SQL> CREATE or replace VIEW vsecure_with_pipe AS
    SELECT *
    FROM TABLE ( pkg_getdata.f_get_vbase ( ) )
    View created.
    SQL> -----------------------------------------
    SQL> -- this would grant select on the 2 views, one with nested view, one with nested pipeline function
    SQL> -----------------------------------------
    SQL> GRANT SELECT ON vsecure TO test_user
    Grant complete.
    SQL> GRANT SELECT ON vsecure_with_pipe TO test_user
    Grant complete.
    SQL> explain plan for
    SELECT *
    FROM vsecure
    WHERE MESSAGE LIKE 'HELLO%'
    Explain complete.
    SQL> SELECT *
    FROM TABLE ( DBMS_XPLAN.display ( ) )
    PLAN_TABLE_OUTPUT
    Plan hash value: 3905984671
    | Id | Operation | Name | Rows | Bytes |TempSpc| Cost (%CPU)| Time |
    | 0 | SELECT STATEMENT | | 16939 | 2365K| | 3098 (3)| 00:00:54 |
    |* 1 | HASH JOIN | | 16939 | 2365K| 2120K| 3098 (3)| 00:00:54 |
    |* 2 | HASH JOIN | | 24103 | 1835K| | 993 (5)| 00:00:18 |
    |* 3 | TABLE ACCESS FULL| TABLE_1 | 24102 | 1529K| | 426 (5)| 00:00:08 |
    | 4 | TABLE ACCESS FULL| TABLE_2 | 1175K| 14M| | 559 (3)| 00:00:10 |
    | 5 | TABLE ACCESS FULL | TABLE_3 | 826K| 51M| | 415 (3)| 00:00:08 |
    Predicate Information (identified by operation id):
    1 - access("B"."ID"="C"."ID")
    2 - access("A"."ID"="B"."ID")
    3 - filter("A"."MESSAGE" LIKE 'HELLO%')
    Note
    PLAN_TABLE_OUTPUT
    - dynamic sampling used for this statement
    23 rows selected.
    SQL> -----------------------------------------
    SQL> -- note that the explain plan shows the predicate pushed down into the base view.
    SQL> -----------------------------------------
    SQL> explain plan for
    SELECT count(*)
    FROM vsecure_with_pipe
    WHERE MESSAGE LIKE 'HELLO%'
    Explain complete.
    SQL> SELECT *
    FROM TABLE ( DBMS_XPLAN.display ( ) )
    PLAN_TABLE_OUTPUT
    Plan hash value: 19045890
    | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
    | 0 | SELECT STATEMENT | | 1 | 2 | 15 (0)| 00:00:01 |
    | 1 | SORT AGGREGATE | | 1 | 2 | | |
    |* 2 | COLLECTION ITERATOR PICKLER FETCH| F_GET_VBASE | | | | |
    Predicate Information (identified by operation id):
    2 - filter(VALUE(KOKBF$) LIKE 'HELLO%')
    14 rows selected.
    SQL> -----------------------------------------
    SQL> -- note that the filter is applied on the results of the pipeline function
    SQL> -----------------------------------------
    SQL> set timing on
    SQL> SELECT count(*)
    FROM vsecure
    WHERE MESSAGE LIKE 'HELLO%'
    COUNT(*)
    19999
    1 row selected.
    Elapsed: 00:00:01.42
    SQL> SELECT count(*)
    FROM vsecure_with_pipe
    WHERE MESSAGE LIKE 'HELLO%'
    COUNT(*)
    19999
    1 row selected.
    Elapsed: 00:00:04.11
    SQL> -----------------------------------------
    SQL> -- note the difference in the execution times.
    SQL> -----------------------------------------

  • My 2009 macbookpro has begun running very slowly, apps freeze and pages hang ... i've run EtreCheck and there are problems but don't know how to sort

    my 2009 macbookpro has begun running very slowly, apps freeze and pages hang ... i've run EtreCheck and there are problems but don't know how to sort ... ran CleanMyMac and freed up about 30GB of space but didn't help ... ran AdwareMedic so that's been sorted but the other issues that came up on the EtreCheck I need help with however i can't figure out how to paste the results on this page

    thanks thomas ... here it comes
    EtreCheck version: 2.1.5 (108)
    Report generated December 29, 2014 at 5:03:07 PM GMT
    Click the [Support] links for help with non-Apple products.
    Click the [Details] links for more information about that line.
    Click the [Adware] links for help removing adware.
    Hardware Information: ℹ️
        MacBook Pro (17-inch, Early 2009) (Verified)
        MacBook Pro - model: MacBookPro5,2
        1 2.66 GHz Intel Core 2 Duo CPU: 2-core
        4 GB RAM Upgradeable
            BANK 0/DIMM0
                2 GB DDR3 1067 MHz ok
            BANK 1/DIMM0
                2 GB DDR3 1067 MHz ok
        Bluetooth: Old - Handoff/Airdrop2 not supported
        Wireless:  en1: 802.11 a/b/g/n
    Video Information: ℹ️
        NVIDIA GeForce 9400M - VRAM: 256 MB
            Color LCD 1920 x 1200
        NVIDIA GeForce 9600M GT - VRAM: 512 MB
    System Software: ℹ️
        OS X 10.9.5 (13F34) - Uptime: 0:5:36
    Disk Information: ℹ️
        FUJITSU MHZ2320BH FFS G1 disk0 : (320.07 GB)
            EFI (disk0s1) <not mounted> : 210 MB
            [redacted]'s world too (disk0s2) / : 319.21 GB (30.39 GB free)
            Recovery HD (disk0s3) <not mounted>  [Recovery]: 650 MB
        MATSHITADVD-R   UJ-868 
    USB Information: ℹ️
        Apple Inc. Built-in iSight
        Apple Inc. iPhone
        Logitech USB Receiver
        Apple Inc. BRCM2046 Hub
            Apple Inc. Bluetooth USB Host Controller
        Apple, Inc. Apple Internal Keyboard / Trackpad
        Apple Computer, Inc. IR Receiver
    Configuration files: ℹ️
        /etc/hosts - Count: 29 - Corrupt!
    Gatekeeper: ℹ️
        Mac App Store and identified developers
    Kernel Extensions: ℹ️
            /Library/Application Support/Roxio
        [not loaded]    com.roxio.TDIXController (1.7) [Support]
            /System/Library/Extensions
        [not loaded]    com.kensington.mouseworks.iokit.KensingtonMouseDriver (3.0) [Support]
            /System/Library/Extensions/KensingtonMouseDriver.kext/Contents/PlugIns
        [not loaded]    com.kensington.mouseworks.driver.ADBID32Mouse (3.0) [Support]
        [not loaded]    com.kensington.mouseworks.driver.ADBID32MouseX1 (3.0) [Support]
        [not loaded]    com.kensington.mouseworks.driver.ADBID4Mouse (3.0) [Support]
        [not loaded]    com.kensington.mouseworks.driver.ADBID4MouseX1 (3.0) [Support]
        [not loaded]    com.kensington.mouseworks.driver.KMWBluetoothHIDMouse (3.0) [Support]
        [not loaded]    com.kensington.mouseworks.driver.KMWBluetoothOldHIDMouse (3.0) [Support]
        [not loaded]    com.kensington.mouseworks.driver.KMWUSBHIDMouse (3.0) [Support]
        [not loaded]    com.kensington.mouseworks.driver.USBMouseX1 (3.0) [Support]
        [not loaded]    com.kensington.mouseworks.driver.VirtualMouse (3.0) [Support]
        [not loaded]    com.kensington.mouseworks.driver.VirtualMouseX1 (3.0) [Support]
        [not loaded]    com.kensington.mouseworks.iokit.KensingtonMouseDriverX1 (3.0) [Support]
    Startup Items: ℹ️
        AdobeVersionCueCS2: Path: /Library/StartupItems/AdobeVersionCueCS2
        Firewall: Path: /Library/StartupItems/Firewall
        RetroRun: Path: /Library/StartupItems/RetroRun
        Startup items are obsolete in OS X Yosemite
    Launch Agents: ℹ️
        [not loaded]    com.adobe.AAM.Updater-1.0.plist [Support]
        [loaded]    com.adobe.CS4ServiceManager.plist [Support]
        [loaded]    com.adobe.CS5ServiceManager.plist [Support]
        [invalid?]    com.oracle.java.Java-Updater.plist [Support]
    Launch Daemons: ℹ️
        [loaded]    com.adobe.fpsaud.plist [Support]
        [invalid?]    com.adobe.SwitchBoard.plist [Support]
        [loaded]    com.adobe.versioncueCS3.plist [Support]
        [loaded]    com.adobe.versioncueCS4.plist [Support]
        [running]    com.atomicbird.macaroni.launchd.plist [Support]
        [loaded]    com.macpaw.CleanMyMac2.Agent.plist [Support]
        [invalid?]    com.oracle.java.Helper-Tool.plist [Support]
        [loaded]    com.prosofteng.DriveGenius.locum.plist [Support]
        [loaded]    com.skype.skypeinstaller.plist [Support]
    User Launch Agents: ℹ️
        [loaded]    com.adobe.AAM.Updater-1.0.plist [Support]
        [loaded]    com.adobe.ARM.[...].plist [Support]
        [loaded]    com.adobe.ARM.[...].plist [Support]
        [loaded]    com.google.keystone.agent.plist [Support]
        [loaded]    com.macpaw.CleanMyMac2Helper.diskSpaceWatcher.plist [Support]
        [loaded]    com.macpaw.CleanMyMac2Helper.scheduledScan.plist [Support]
        [loaded]    com.macpaw.CleanMyMac2Helper.trashWatcher.plist [Support]
        [running]    com.prosofteng.DGMonitor.plist [Support]
        [running]    ws.agile.1PasswordAgent.plist [Support]
    User Login Items: ℹ️
        CNQL1210_ButtonManager    ApplicationHidden (/Library/CFMSupport/CNQL1210_ButtonManager.app)
        System Events    ApplicationHidden (/System/Library/CoreServices/System Events.app)
        Mail    Application (/Applications/Mail.app)
        Firefox    Application (/Applications/Firefox.app)
        AdobeResourceSynchronizer    ApplicationHidden (/Applications/Adobe Reader 9/Adobe Reader.app/Contents/Support/AdobeResourceSynchronizer.app)
        Calendar    Application (/Applications/Calendar.app)
        Skype    Application (/Applications/Skype.app)
        Dropbox    Application (/Applications/Dropbox.app)
        AdobeResourceSynchronizer    ApplicationHidden (/Applications/Adobe Reader.app/Contents/Support/AdobeResourceSynchronizer.app)
        MouseWorks Background    Application (/Library/Application Support/Kensington/MouseWorks.prefPane/Contents/Resources/Support/MouseWorks Background.app)
    Internet Plug-ins: ℹ️
        AdobePDFViewerNPAPI: Version: 11.0.10 - SDK 10.6 [Support]
        Flash Player: Version: 16.0.0.235 - SDK 10.6 [Support]
        EPPEX Plugin: Version: 3.0.0.0 [Support]
        AdobePDFViewer: Version: 11.0.10 - SDK 10.6 [Support]
        ContentUploaderPlugin: Version: 1.2 [Support]
        iPhotoPhotocast: Version: 7.0
        RealPlayer Plugin: Version: Unknown [Support]
        PDEPrint: Version: 2.0 [Support]
        DirectorShockwave: Version: 11.5.2r602 [Support]
        PDF Browser Plugin: Version: 2.4.2 - SDK 10.2 [Support]
        FlashPlayer-10.6: Version: 16.0.0.235 - SDK 10.6 [Support]
        QuickTime Plugin: Version: 7.7.3
        CANONiMAGEGATEWAYDL: Version: 3.0.0.2 [Support]
        DivXBrowserPlugin: Version: 1.3 [Support]
        Silverlight: Version: 5.1.30514.0 - SDK 10.6 [Support]
        Google Earth Web Plug-in: Version: 6.0 [Support]
        Default Browser: Version: 537 - SDK 10.9
        Flip4Mac WMV Plugin: Version: 3.2.0.16   - SDK 10.8 [Support]
        JavaAppletPlugin: Version: 14.9.0 - SDK 10.7 Check version
        OfficeLiveBrowserPlugin: Version: 12.3.6 [Support]
    User internet Plug-ins: ℹ️
        QuickTime Plugin: Version: 6.5.1
        fbplugin_1_0_0: Version: Unknown [Support]
    Safari Extensions: ℹ️
        Ultimate [Installed]
    3rd Party Preference Panes: ℹ️
        ASM  [Support]
        DivX  [Support]
        Flash Player  [Support]
        Flip4Mac WMV  [Support]
        Macaroni  [Support]
    Time Machine: ℹ️
        Skip System Files: NO
        Mobile backups: OFF
        Auto backup: NO - Auto backup turned off
        Destinations:
            G-DRIVE Mini [Local]
            Total size: 999.86 GB
            Total number of backups: 7
            Oldest backup: 2014-07-09 00:13:07 +0000
            Last backup: 2014-12-10 22:18:57 +0000
            Size of backup disk: Excellent
                Backup size 999.86 GB > (Disk size 0 B X 3)
    Top Processes by CPU: ℹ️
             6%    WindowServer
             3%    firefox
             1%    mds_stores
             0%    mdworker
             0%    Skype
    Top Processes by Memory: ℹ️
        348 MB    firefox
        137 MB    Skype
        122 MB    mds_stores
        120 MB    com.apple.IconServicesAgent
        73 MB    Dropbox
    Virtual Memory Information: ℹ️
        1.26 GB    Free RAM
        1.74 GB    Active RAM
        477 MB    Inactive RAM
        543 MB    Wired RAM
        503 MB    Page-ins
        0 B    Page-outs
    Diagnostics Information: ℹ️
        Dec 29, 2014, 04:58:09 PM    Self test - passed
        Dec 29, 2014, 10:58:04 AM    /Library/Logs/DiagnosticReports/Keychain Access_2014-12-29-105804_[redacted].hang
        Dec 29, 2014, 10:54:33 AM    /Library/Logs/DiagnosticReports/Keychain Access_2014-12-29-105433_[redacted].hang
        Dec 29, 2014, 10:52:33 AM    /Library/Logs/DiagnosticReports/Keychain Access_2014-12-29-105233_[redacted].hang
        Dec 29, 2014, 10:50:24 AM    /Library/Logs/DiagnosticReports/Keychain Access_2014-12-29-105024_[redacted].hang
        Dec 29, 2014, 10:50:24 AM    /Library/Logs/DiagnosticReports/Skype_2014-12-29-105024_[redacted].hang

  • How to sort Data in XML template (rtf) file?

    Hi, I have an oracle 11i custom report (rdf) with an xml output to a PDF. There is a formula column in the report. Now I need the data to be sorted on this formula column. As we cannot sort on formula column, i have decided to find a way to sort it in the data in the XML template. But I don't really know how to sort and also where to specify the sort tag in the rtf file. I appreciate your response.
    Databse version : 9.2.0.8.0
    E-Biz Version : 11.5.10.2
    Oracle Reports Version : 6.0.8.27.0
    Oracle BI version : 10.1.3.2.1
    Note : I posted this question under : XML General forum also. But did not get any response. I assumed that may be thats not the right place to post it as my report is in e-Biz environment.

    Hi
    As long as you don't have your ^field commands grouped inside a ^group the order in the .dat file is not important. Your last command
    ^field BG_DOC_LN__LN_AM
    246624.12
    should populate field BG_DOC_LN_AM wherever you place it on your form. Obviously you need to name the fields according to your ^field commands and not just use tab (move to next field).
    Shout if this was not what you are asking.
    Stale Sodal

  • Sorting character column ( used in order by clause dynamically)

    Hi,
    I need help on sorting character-based numbers. Like say, I want to sort customers based on street numbers(which is a character string being used in the
    order by clause) they live in.
    The criteria are :
    i. Numbers must take precedence.
    This being a character string, 1000001 comes before 2. This shouldn't happen. And you cannot use to_number
    since using it with a string having characters in it would raise an error.
    ii. If only a single alphabet occurs as the last character, then treat the whole string as a number except the last character and then sort it
    as if sorting a number. Something like : if you have 1000A, 200D, 200B, 1000X, the result would be 200B,200D,1000A,1000X.
    iii. if a character occurs elsewhere in the string, then perform the search normally as if performing a character search.
    The output of the following data :
    100
    A101
    B100A
    110C
    C120B
    120
    100020
    120C
    C1100
    100D
    would be like :
    100
    100D
    110C
    120
    120C
    100020
    A101
    B100A
    C120B
    C1100
    Please note that the sort is being done dynamically, so I could have access to the values of the street numbers only during run time.
    Any help is really appreciated.
    Thanks in advance.
    Regards,
    Anil.

    Create a function to test whether the column is numeric :
    create FUNCTION is_numeric(v_number VARCHAR2)
    RETURN INTEGER
    IS
    l_number NUMBER;
    BEGIN
    IF INSTR(UPPER(v_number),'E') > 0 THEN
    RETURN 0;
    END IF;
    l_number := TO_NUMBER(v_number);
    RETURN 1;
    EXCEPTION
    WHEN OTHERS THEN
    RETURN 0;
    END;
    And try this query
    Assume the table name is TEST with column STREET
    select * from TEST
    order by case is_numeric(STREET) when 1 then LPAD(STREET,20, ' ') else STREET end
    Please make sure that 20 mentioned above is the column size for STREET.
    Hope this helps.
    -Nags

  • Sorting technique used by oracle for "order by" clause.

    Hi All,
    it could be very help to me if you provide some information about sorting technique used by oracle engine for order by clause.
    Issue i am facing :
    Table : xx
    Line Date
    1 05-06-2013 00:00:00
    2 05-06-2013 00:00:00
    when we query above table using order by date, it is returning line 2 prior to line 1. we would like to know why it is returning line 2 first?
    Regards,
    Ram

    >
    it could be very help to me if you provide some information about sorting technique used by oracle engine for order by clause.
    >
    Well ok - but be warned that many people wind up being sorry they ask that question. Hopefully Hemant's answer is what you really wanted.
    See 'Linguistic Sorting and String Searching' in the Oracle® Database Globalization Support Guide
    http://docs.oracle.com/cd/B28359_01/server.111/b28298/ch5lingsort.htm
    Sorting will be controlled by the settings of NLS_LANGUAGE, NLS_SORT and NLS_COMP.
    Here is the doc page for NLS_SORT
    http://docs.oracle.com/cd/B28359_01/server.111/b28298/ch3globenv.htm#i1008393
    >
    NLS_SORT specifies the type of sort for character data. It overrides the default value that is derived from NLS_LANGUAGE.
    NLS_SORT contains either of the following values:
    NLS_SORT = BINARY | sort_name
    BINARY specifies a binary sort. sort_name specifies a linguistic sort sequence.
    >
    And the one for NLS_COMP
    http://docs.oracle.com/cd/B28359_01/server.111/b28298/ch3globenv.htm#i1008458
    >
    The value of NLS_COMP affects the comparison behavior of SQL operations.
    You can use NLS_COMP to avoid the cumbersome process of using the NLSSORT function in SQL statements when you want to perform a linguistic comparison instead of a binary comparison. When NLS_COMP is set to LINGUISTIC, SQL operations perform a linguistic comparison based on the value of NLS_SORT. A setting of ANSI is for backward compatibility; in general, you should set NLS_COMP to LINGUISTIC when you want to perform a linguistic comparison.

  • How to run batch file from oracle forms 9i

    Hi everyone.
    i have a data in csv file. i want to upload it to my database. i am using sql loader for it.
    i have made a batch file which run the sql loader and transfer my data to database.
    How to run batch file from oracle forms 9i.
    when i press the button, nothing uploads in my database. (when i simply run the batch file it works).
    here is my code
    Begin
    HOST('C:\temp\batchfile.bat');
    message('done');
    end;
    Thanks in advance
    regards
    sajid

    this is my log file, when i run manually.
    SQL*Loader: Release 10.2.0.1.0 - Production on Thu Jul 1 23:27:53 2010
    Copyright (c) 1982, 2005, Oracle. All rights reserved.
    Control File: file_to_upload.ctl
    There are 2 data files:
    Data File: sk.csv
    Bad File: sk.bad
    Discard File: none specified
    (Allow all discards)
    Data File: sk1.csv
    Bad File: sk1.bad
    Discard File: none specified
    (Allow all discards)
    Number to load: ALL
    Number to skip: 0
    Errors allowed: 50
    Bind array: 64 rows, maximum of 256000 bytes
    Continuation: none specified
    Path used: Conventional
    Table KHAN, loaded from every logical record.
    Insert option in effect for this table: APPEND
    Column Name Position Len Term Encl Datatype
    SR FIRST * , O(") CHARACTER
    DATES NEXT * , O(") CHARACTER
    AGENT NEXT * , O(") CHARACTER
    COUNTRY NEXT * , O(") CHARACTER
    TRANSACTIONS NEXT * , O(") CHARACTER
    PKR NEXT * , O(") CHARACTER
    USD NEXT * , O(") CHARACTER
    BANK NEXT * , O(") CHARACTER
    Table KHAN:
    11088 Rows successfully loaded.
    0 Rows not loaded due to data errors.
    0 Rows not loaded because all WHEN clauses were failed.
    0 Rows not loaded because all fields were null.
    Space allocated for bind array: 132096 bytes(64 rows)
    Read buffer bytes: 1048576
    Total logical records skipped: 0
    Total logical records read: 11088
    Total logical records rejected: 0
    Total logical records discarded: 0
    Run began on Thu Jul 01 23:27:53 2010
    Run ended on Thu Jul 01 23:27:54 2010
    Elapsed time was: 00:00:00.63
    CPU time was: 00:00:00.17

  • Sort in numerical order

    can someone show me how to sort this in numerical order?
    only the first column in order, but the rest of the columns will follow the sorted values.
    does that make sense?
    Solved!
    Go to Solution.

    Cool set of VIs, thanks for sharing pcardinale.
    In this special case the following simple code would also work.
    Ben64
    Attachments:
    Untitled 2.vi ‏11 KB

  • How to sort a string as integer

    Hi,
    I need to sort some log files which got timestamps as below:
    1149807013000 this is line no 1
    1149807023000 this is line no 2
    I am converting the date time stamp of the log file to Date.getTime() in a ArrayList and then want to sort this so that i will get them sorted from oldest timestamp to new.
    I am using Collections.sort(ArrayList) method, but it is sorting them as String. As this is simple array would it be possible to tell the sort program to sort as Numeric ?. I donot know how to write comparator for this kind of Array, any help here appreciated.
    Thanks, Mani

    I am posting my method here:
    public static void sortLogs(ArrayList al, JTextArea txa){
            Date t;
            SimpleDateFormat formatter;       
            ArrayList al2=new ArrayList();
            for (int i=0;i < al.size();i++) {
                File file=new File(al.get(i).toString());
                if (file.exists()){
                    if ( file.getName().startsWith("sys_log")){
                        //Jun 26 12:40:51 2006 BoxMonitor:3:526 enclosure 2 failed to respond to ping at management switch
                        //MMMsDDsTIMEsYR_data
                        try{
                            BufferedReader in=new BufferedReader(new FileReader(file));
                            String line=null;
                            formatter=new SimpleDateFormat("MMM dd HH:mm:ss yyyy",new Locale("en", "US"));
                            while ( (line=in.readLine())!=null){
                                Pattern p=Pattern.compile("^([JFMASOND][aepuco][nbrylgptvc])\\s+([\\d]+)\\s+([\\d]+[:][\\d]+[:][\\d]+)\\s+([\\d]+)\\s+(.*)");// \\s+(.*)");
                                Matcher m=p.matcher(line);
                                if (m.find()){
                                    t=formatter.parse(m.group(1)+" "+m.group(2)+" "+m.group(3)+" "+m.group(4));
                                    al2.add(t.getTime() + " "+file.getName()+" " + m.group(5));                               
                        }catch(Exception ex){
                            System.err.println("Error on file "+file.getPath()+ " error is "+ ex.getMessage());
            if ( al2.size() > 0) {
                t=new Date();
                formatter=new SimpleDateFormat("MMM dd HH:mm:ss yyyy",new Locale("en", "US"));
                Collections.sort(al2);    //once arraylist al2 is populated with all the files, want to sort which contains String lines like 102020000 filename data
                Pattern p=Pattern.compile("^(\\d+)\\s+(.*)");
                Matcher m;
                for (int j=0;j< al2.size();j++){
                    m=p.matcher(al2.get(j).toString());                          
                    if ( m.find()) {
                       t.setTime(Long.parseLong(m.group(1)));
                       txa.append(formatter.format(t)+" "+m.group(2)+"\n");                               
        }I am using Collections.sort. As you can see here i am perl guy trying to port my script to java. Was using unix sort on my perl script, but here i am stuck :-).
    The ArrayList populated here from reading the text files - finding the date pattern - converting to ephoch seconds, and then i need to sort before converting back to normal date. When i verified the sort output, i see sorting like below:
    1
    100
    2
    20
    where as in numeric i would like to see,
    1
    2
    20
    100
    Thanks for your help.

  • How to Sort I variable of type VariableOneToOneMapping

    I am having a object mapping like this
    interface IUserName {
    public String getUserName();
    This method will be implemented by two class say A & B,Both the implementation looks like this
    class A implements IUserName {
    String name;
    public String getUserName() {
    return name;
    public void setUserName(String na) {
    name = nm;
    class c {
    ValueHolderInterface name= new ValueHolder();
    public IUserName getName(){
    return (IUserName ) name.getValue();
    Similarly the Class B also has the same implementation.The variable name in Cis mapped as VariableOneToOneMapping .i.e, name is mapped to Interface IUserName.
    Please let me know how to sort this expression name in the class C.
    I tried this
    ExpressionBuilder eb = new ExpressionBuilder()
    Expression exp = eb.get("name").get("name").ascending();
    ReadAllQuery ra = new ReadAllQuery(c.class);
    ra.setOrderByExpressions(exp);
    But I am getting the exception like this ----->
    (ERROR) Exception thrown while executing query. EXCEPTION [TOPLINK-6072] (TopLink - 9.0.3.5 (Build 436)): oracle.toplink.exceptions.QueryException EXCEPTION DESCRIPTION: Querying across a VariableOneToOneMapping is not supported.
    Please let me know how to overcome this issue.

    It is not possible to perform a joining query across a variable class 1:1 mapping. If you need this sort of querying I would recommend using a shared table between your interface implementers and inheritance. Then you can have a relationship to the root class and query on the shared attributes.
    Doug

  • How to print a something in oracle sql developer

    Hello all
    Do you know How to print a something in oracle sql developer? i mean for example in the query we write something, (offcourse i dont mean comments)
    thank u in advance.
    best

    1003209 wrote:
    Hello all
    Do you know How to print a something in oracle sql developer? i mean for example in the query we write something, (offcourse i dont mean comments)
    thank u in advance.
    bestDBMS_OUTPUT()

  • How to sort files and folders like Windows

    I don't know if this is specific to Arch or every other Linux distro but one thing that really bugs me in Arch is how files and folders are sorted. I use Windows as my main OS (don't start on that please) and I have one folder properly organized exactly as I want it and I like it how Windows sorts this. I access that same folder from my Arch installation, the problem is that the sorting is different and it gets on my nerves lol...
    This is how Windows sorts that specific folder:
    C:\Users\Nazgulled\Documents\University>dir /O
    Volume in drive C is Vista
    Volume Serial Number is F84E-02BE
    Directory of C:\Users\Nazgulled\Documents\University
    05-08-2009 15:34 <DIR> .
    05-08-2009 15:34 <DIR> ..
    05-08-2009 11:10 <DIR> [Archives]
    05-08-2009 14:38 <DIR> [Developers]
    05-08-2009 11:17 <DIR> [X] 1) Cálculo II
    05-08-2009 11:18 <DIR> [X] 2) Análise de Custos
    05-08-2009 11:18 <DIR> [X] 2) Cálculo de Programas
    05-08-2009 11:18 <DIR> [X] 2) Laboratórios de Informática III
    05-08-2009 11:18 <DIR> 2) Algoritmos e Complexidade
    05-08-2009 11:18 <DIR> 2) Arquitectura de Computadores
    05-08-2009 11:18 <DIR> 2) Comunicaçao de Dados
    05-08-2009 11:18 <DIR> 2) Engenharia Económica
    05-08-2009 11:18 <DIR> 2) Estatística Aplicada
    0 File(s) 0 bytes
    13 Dir(s) 24.700.485.632 bytes free
    And this is how Arch does it:
    nazgulled ~/University $ ls -l
    total 7
    drwxr-xr-x 1 nazgulled nazgulled 4096 2009-08-05 11:18 2) Algoritmos e Complexidade
    drwxr-xr-x 1 nazgulled nazgulled 4096 2009-08-05 11:18 2) Arquitectura de Computadores
    drwxr-xr-x 1 nazgulled nazgulled 4096 2009-08-05 11:18 2) Comunicação de Dados
    drwxr-xr-x 1 nazgulled nazgulled 4096 2009-08-05 11:18 2) Engenharia Económica
    drwxr-xr-x 1 nazgulled nazgulled 8192 2009-08-05 11:18 2) Estatística Aplicada
    drwxr-xr-x 1 nazgulled nazgulled 4096 2009-08-05 11:10 [Archives]
    drwxr-xr-x 1 nazgulled nazgulled 4096 2009-08-05 14:38 [Developers]
    drwxr-xr-x 1 nazgulled nazgulled 4096 2009-08-05 11:17 [X] 1) Cálculo II
    drwxr-xr-x 1 nazgulled nazgulled 12288 2009-08-05 11:18 [X] 2) Análise de Custos
    drwxr-xr-x 1 nazgulled nazgulled 4096 2009-08-05 11:18 [X] 2) Cálculo de Programas
    drwxr-xr-x 1 nazgulled nazgulled 4096 2009-08-05 11:18 [X] 2) Laboratórios de Informática III
    How can I get Arch/Linux to sort exactly the same as Windows?
    Last edited by Nazgulled (2009-08-05 14:41:47)

    toad wrote:
    Nazgulled wrote:Surely there must be a way to have the same sorting collation in Linux like in Windows
    Ah, no. The way they are doing it is nonsensical and not good practice for a unix style system. Having said that, some solutions have already been offered in this thread.
    While you are free to continue to ask others to help you achieve your aims, it may be more convenient for you to adapt to a structure that is displayed the same way under all systems (just to avoid frustration - not saying you _should_ do it ).
    I really don't care if it's nonsensical, I use Windows 95% of the time or more, it's my main OS, I'm used to it and I like it. Why should I care if it's not a good practice for a unix style system? I just want things to behave the way I like and for a free system like Linux where it doesn't even compare to Windows in terms of freedom in what I can do with it and configure the way I like, it sure is hard to change the way folders/files are sorted...
    It sucks that there isn't a proper solution but I'm not going to adapt anything, that would be nonsensical... But if I have to, I can live with the fact that there isn't a good solution and leave it as it is
    Thanks everyone for their input, "topic closed".

  • How to sort the data in JSP using stylesheet sorting?

    Hi, i extracted data out in and display them <%=data%> in the jsp, but how to sort? do i have to provide a drop down list that gives different sorting options, and when user clicks on one option, say sort by title, the collection of results are sorted out on the same jsp page? so all in all, only one jsp page is needed or do i need to create xml files, etc?
    i have no idea how to integrate the xml sorting into the jsp page, even after seeing online help, cos there is no example of a jsp page with sorting to refer to. PLease help, thanks alot!

    im getting the data from beans, but one of the requirements was that i cant use the database to sort and display but i have to use xslt to do the sorting in the jsps, so i have no idea how to do so. possible to give an example? thanks

Maybe you are looking for

  • ABAP HR enhancement for Short profile in PB20 or PB30

    Hello gurus, I am trying to display shortprofile in trnsaction PB20 and PB30. Here values are coming but I want to know from where and how this values are coming as I need to display some extra text for this. Here requirement is there is some short p

  • ResultWaiter, is there any in java standard API

    I need a class like the following for "synchronizing" asynchronus results. public class ResultWaiter {    private Object lock;    private Exception ex;    private Object result;    public ResultWaiter() {       lock = new Object();       result= null

  • Zoom out problem

    helllo, i have problem of image quality when i m doing the zoominh operation. when i was doing the zoom out the quality of the image get blur.. i have nt getign the proper clear image.. bi = compat ? getCompatibleImage(zoomW, zoomH): new BufferedImag

  • 10g Forms Developer - ORA 12541error message

    This issue involves opening an existing form (.fmb) in Forms Builder. Initially an ORA-12560: TNS protocol adapter error was generated, but now I'm faced with an entirely different error message: ORA-12541: TNS: No Listener. I searched the specific e

  • My iPad appears under portable devices in W7 64bit, so iTunes cannot see it

    My iPad appears under portable devices in device manager in Windows 7 64bit, so iTunes cannot see it.  I have tried unistalling the device, but it always reappears as a portable device.  My ipod shuffle also appears as a portable device, but it is se