Help needed on SQL Where Command  in APEX

Hi all !
Some one know how to use a url referal as a variable with the WHERE command ?
I Have this url : http://10.10.10.2/apex/f?p=116:20:6597653175650651::NO::P20_TEST_N3:1 and i would like to have the :1 or everything else (depend of the selection of the user) at the end of the url as a variable of the WHERE command in the P20_TEST_N3 page of my application.
Thanks in advance for your response !

Hi,
Try report query
SELECT GLE1N2_NOM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           AS Services,
  GLE1N2_SOLDES_AC_NET_1           + GLE1N2_SOLDES_AC_NET_1 + GLE1N2_SOLDES_AC_NET_2 + GLE1N2_SOLDES_AC_NET_3 + GLE1N2_SOLDES_AC_NET_4 + GLE1N2_SOLDES_AC_NET_5 + GLE1N2_SOLDES_AC_NET_6 + GLE1N2_SOLDES_AC_NET_7                                                                                                                                                                                                                                                                                                                                                                           AS "Total à ce jour",
  GLE1N2_SOLDES_BC_NET_1           + GLE1N2_SOLDES_BC_NET_2 + GLE1N2_SOLDES_BC_NET_3 + GLE1N2_SOLDES_BC_NET_4 + GLE1N2_SOLDES_BC_NET_5 + GLE1N2_SOLDES_BC_NET_6 + GLE1N2_SOLDES_BC_NET_7                                                                                                                                                                                                                                                                                                                                                                                                    AS Budget,
  ((GLE1N2_SOLDES_BC_NET_1         + GLE1N2_SOLDES_BC_NET_2 + GLE1N2_SOLDES_BC_NET_3 + GLE1N2_SOLDES_BC_NET_4 + GLE1N2_SOLDES_BC_NET_5 + GLE1N2_SOLDES_BC_NET_6 + GLE1N2_SOLDES_BC_NET_7)-( GLE1N2_SOLDES_AC_NET_1 + GLE1N2_SOLDES_AC_NET_1 + GLE1N2_SOLDES_AC_NET_2 + GLE1N2_SOLDES_AC_NET_3 + GLE1N2_SOLDES_AC_NET_4 + GLE1N2_SOLDES_AC_NET_5 + GLE1N2_SOLDES_AC_NET_6 + GLE1N2_SOLDES_AC_NET_7))                                                                                                                                                                                         AS "Variation en $",
  ROUND(((((GLE1N2_SOLDES_BC_NET_1 + GLE1N2_SOLDES_BC_NET_2 + GLE1N2_SOLDES_BC_NET_3 + GLE1N2_SOLDES_BC_NET_4 + GLE1N2_SOLDES_BC_NET_5 + GLE1N2_SOLDES_BC_NET_6 + GLE1N2_SOLDES_BC_NET_7)-( GLE1N2_SOLDES_AC_NET_1 + GLE1N2_SOLDES_AC_NET_1 + GLE1N2_SOLDES_AC_NET_2 + GLE1N2_SOLDES_AC_NET_3 + GLE1N2_SOLDES_AC_NET_4 + GLE1N2_SOLDES_AC_NET_5 + GLE1N2_SOLDES_AC_NET_6 + GLE1N2_SOLDES_AC_NET_7))/(GLE1N2_SOLDES_BC_NET_1 + GLE1N2_SOLDES_BC_NET_2 + GLE1N2_SOLDES_BC_NET_3 + GLE1N2_SOLDES_BC_NET_4 + GLE1N2_SOLDES_BC_NET_5 + GLE1N2_SOLDES_BC_NET_6 + GLE1N2_SOLDES_BC_NET_7))*100),2) AS "Variation %"
FROM DM2_XWC_GLE1N2
WHERE GLE1N2_CENTRE_ACT_N1 = :P20_TEST_N3And you have item P20_TEST_N3 ? And you do not have process that clear that item value?
PS: do not give alias like "Variation en $". Give simple alias and use report attributes to give real column name
Regards,
Jari

Similar Messages

  • Help Needed in SQL QPAC

    Hi there,
    I need some help regarding the SQL QPAC which is a built in QPAC in Adobe Livecycle Workflow. The SQL QPAC takes MYSQL as the default database. Suppose if we need to connect to the SQL Server or any other database, what is the procedure to do that.
    Suraj

    Hi Suraj
    You need to deploy a second copy of the SQL QPAC, and point it at a different datasource. The datasource is defined as a deployment parameter (it will prompt you when you deploy the new version of the qpac).
    You will also need to define the datasource in your application server. This is done in different ways for different application servers - for details, please see: standards_based_qpacs.pdf (part of the Workflow SDK), page 12, "Creating a JNDI datasource".
    Alternately, you can try out our SQLPlus QPAC. This allows you to directly specify connection url, driver, username and password. The SQLPlus QPAC does a lot of other things that the regular SQL QPAC doesn't do, such as handling multiple rows, testing your query, and outputting the data in a variety of ways.
    Details at: http://www.avoka.com/avoka/qpac_library.shtml
    Howard

  • VCM installation help needed on SQL DB and Reporting server

    Hi All,
    I'm new to VCM and now i got stuck at the SQL DB and Report server portion.
    I'm running the vcm server on VM and the SQL is a physical server, both are sitting on the same LAN.
    I have create the SQL DB but VCM just fail to validate the DB and report server.
    I login to VCM using a Domain account for installation, and i tried to testing the DB using ODBC from the window, result fail.
    Error message as attach.
    I'm now totally lost on SQL portion.
    My Question:
    Is there any configuration needed on SQL DB?
    How to get the reporting server to working?
    What port is needed to it all working??
    VCM server Ms Win2012.
    SQL version 2012.
    Many thanks to all who reply.

    Hi Simonhoo79,
    For SSRS,   first check whether the report server link is accessible from your browser : "http://s01-fes-vcm1:80/ReportServer" . If you continue to get 404 error there also, then you need to reconfigure you report server first before proceeding to vcm installation. Follow the steps on below link on how to reconfigure report server using report services configuration Manager for 404 error.
    http://social.msdn.microsoft.com/Forums/sqlserver/en-US/75910bcb-a879-4eb7-9757-acc45201fa3a/can-not-connect-to-reportserver-http-404-file-not-found?forum=sqlexpress
    For SQL server ODBC connection,
    Dont create ODBC connection for SQL Native Client. Create ODBC connection for SQL Server.
    1. Open ODBC Data Source Administrator
    2. Click User DSN tab and Click Add button.
    3. Select SQL server and click finish
    4. Give name and description and Give the SQL server name (with instance name if your using named instance) or IP in the Server text box.
    5. Click Next and select either Windows authentication or sql authentication based on your SQL server authentication mode and click next.
    6. If the details given are correct then it will proceed further and  check "Change the dafault database to" to your VCM database
    7. Click next and finish and try test data source.
    VCM 5.7.2 and below will support installation only on windows server 2008 R2  and it doesn't support windows server 2012  but it support both 2008 and 2012 sql servers.

  • Help Needed In SQL Query

    HI All,
    Oracle sql clarification required
    Sample Table:
    empno empname Job mgr_id hire_date salary deptno
    7788 SCOTT ANALYST 7566 19-APR-87 3000 20
    7902 FORD ANALYST 7566 03-DEC-81 3000 20
    7934 MILLER CLERK 7782 23-JAN-82 1300 10
    7900 JAMES CLERK 7698 03-DEC-81 950 30
    7369 SMITH CLERK 7902 17-DEC-80 800 20
    7876 ADAMS CLERK 7788 23-MAY-87 1100 20
    Need "single / one" sql for this requirement statement:
    There will be 2 drop down boxes (1st - Job list, 2nd - empno) in the form in which the following result set is expected
    1) When user selects value from 1st drop down box (job) as "ANALYST" leaving the second drop down unselected, the result expected is 2 (no. of rows for that job)
    2) When user selects value from 1st drop down box (job) as "ANALYST" and the value from 2nd drop down box as 7902, the result expected is 1 (no of rows for that job and empno)
    Sqls which I have tried from my side (given below) didn't give the expected result and please do help me in correcting this
    select count(1) from scott.emp where job='ANALYST' and ( empno = :empno or empno is null ) ;
    Please help for this requirement. Any help is deeply appreciated.
    Thanks
    Zaheer

    Hi,
    welcome to the forum.
    Please read SQL and PL/SQL FAQ
    When you put some code or output please enclose it between two lines starting with {noformat}{noformat}
    i.e.:
    {noformat}{noformat}
    SELECT ...
    {noformat}{noformat}
    For your question the following will both work:SQL> select * from emp
    where job='ANALYST' and (empno =:empno or :empno is null)
    EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
    7788 SCOTT ANALYST 7566 19/04/1987 00:00:00 3000 20
    7902 FORD ANALYST 7566 03/12/1981 00:00:00 3000 20
    2 rows selected.
    SQL> select * from emp
    where job='ANALYST' and empno =NVL(:empno, empno)
    EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
    7788 SCOTT ANALYST 7566 19/04/1987 00:00:00 3000 20
    7902 FORD ANALYST 7566 03/12/1981 00:00:00 3000 20
    2 rows selected.
    Regards.
    Al                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Help needed in SQL statement

    Hi,
    From the SQL statement below, i need help in explaining what does the line "WHERE ( lims_sys.result.result_template_id = lims_sys.result_template_limit.result_template_id (+))" do?
    This statement was written by a vendor and now i have problem displaying some new data. Only a portion of what i need is displayed.
    SELECT "LIMS_SYS"."RESULT"."DESCRIPTION",
    "LIMS_SYS"."RESULT_TEMPLATE_LIMIT"."NUMERIC_LIMIT",
    "LIMS_SYS"."RESULT"."FORMATTED_RESULT",
    "LIMS_SYS"."RESULT"."CONCLUSION",
    "LIMS_SYS"."RESULT_USER"."U_RESULT_SEQUENCE" ,
    "LIMS_SYS"."RESULT"."RESULT_ID"
    FROM "LIMS_SYS"."RESULT",
    "LIMS_SYS"."RESULT_TEMPLATE_LIMIT",
    "LIMS_SYS"."RESULT_USER",
    "LIMS_SYS"."ALIQUOT",
    "LIMS_SYS"."SAMPLE",
    "LIMS_SYS"."SDG",
    "LIMS_SYS"."TEST"
    WHERE ( lims_sys.result.result_template_id = lims_sys.result_template_limit.result_template_id (+)) and
    ( "LIMS_SYS"."RESULT"."RESULT_ID" = "LIMS_SYS"."RESULT_USER"."RESULT_ID" ) and
    ( "LIMS_SYS"."SDG"."SDG_ID" = "LIMS_SYS"."SAMPLE"."SDG_ID" ) and
    ( "LIMS_SYS"."SAMPLE"."SAMPLE_ID" = "LIMS_SYS"."ALIQUOT"."SAMPLE_ID" ) and
    ( "LIMS_SYS"."ALIQUOT"."ALIQUOT_ID" = "LIMS_SYS"."TEST"."ALIQUOT_ID" ) and
    ( "LIMS_SYS"."TEST"."TEST_ID" = "LIMS_SYS"."RESULT"."TEST_ID" ) and
    ( ( LIMS_SYS."SDG"."SDG_ID" = :sdg_id ) AND
    ( LIMS_SYS."RESULT"."STATUS" <> 'X' ) AND
    ( LIMS_SYS."RESULT"."REPORTED" = 'T' ) AND
    ( LIMS_SYS."RESULT_USER"."U_RESULT_CATEGORY" in ( 'Metal' , 'Mean Metal', 'Range Metal')) )
    Thanks for all your help.

    Hi,
    After WHERE .......... is indicates an OUTER Join condition.
    In this type of join, system retrieves the data for matched and
    as well as unmatched.
    Example:
    EMP table have a column DEPTNO with the data 10, 20, 30 (total rows=14)
    DEPT table have a column DEPTNO with the data 10, 20, 30, 40, 50 (total rows=5)
    If the WHERE clause contained EMP.DEPTNO(+) = DEPT.DEPTNO
    then the output contain the data relative to 10, 20, 30, 40, 50 (total rows = 16)
    i.e. 14 rows (with matching data) and 2 rows (with unmatching data)
    Regards,
    Sailaja

  • Help needed for SQL query

    hello ,
    I am a beginner in terms of writing sql queries. I hope some body can help me out.
    I have two tables
    mysql> desc user_group_t;
    ---------------------------------------------------+
    | Field | Type | Null | Key | Default | Extra |
    ---------------------------------------------------+
    | userAccountId | char(8) | | PRI | | |
    | groupId | char(8) | | PRI | | |
    ---------------------------------------------------+
    2 rows in set (0.00 sec)
    mysql> desc group_t;
    ---------------------------------------------------+
    | Field | Type | Null | Key | Default | Extra |
    ---------------------------------------------------+
    | id | char(8) | | PRI | | |
    | name | char(50) | YES | | NULL | |
    | email | char(100) | YES | | NULL | |
    | description | char(254) | YES | | NULL | |
    | parentId | char(8) | YES | | NULL | |
    | creatorId | char(8) | YES | | NULL | |
    | createDate | char(20) | YES | | NULL | |
    | updateDate | char(20) | YES | | NULL | |
    | updatorId | char(8) | YES | | NULL | |
    ---------------------------------------------------+
    9 rows in set (0.00 sec)
    what I want is list of all groups with id,name and #of members(which is the # of rows in the user_group_t for any given id). Importantly I need the groups with 0 members also to be listed. In short my output should contain exactly the same number of rows as in group_t table with an additional column indicating # of members for that group.
    Any help would be greatly appreciated.
    Thanks in Advance.
    -Vasanth

    Thanks Donald,
    Actually I figured it out, with the following query:
    select id,name,sum(if(groupid is not null,1,0)) as members from group_t left join user_group_t on id=groupid group by id;
    I tried your solution, but mysql says there is an error at '+' . Anyway I modified your solution to the one below and it worked.
    select a.id, a.name, count(b.groupid) from group_t a left join user_group_t b on a.id=b.groupid group by a.id, a.name;
    I tried that before but then I used Count(*) instead of count on groupid. Your solution is elagant and I will go with yours.
    Thanks again.
    Vasanth

  • Help need in sql

    i have a scenario like
    bank_division sum(amount) total_percentage(calculated by : / total sum of adjacent amounts i.e(10000+2000+3000+4000) *100
    aaaa 10000
    bbb 2000
    ccc 3000
    dddd 40000
    for above thing i have written sql like
    select bank_division,sum(amount)  from bank group by bank;
    but i am unable to calculate percentage for each bank_division..........
    .its like for aaaa correspoding percentage will be
    10000/ total sum of adjacent amounts i.e(10000+2000+3000+4000) *100
    and for bbb it will be
    2000/ total sum of adjacent amounts i.e(10000+2000+3000+4000) *100
    so on...
    can any one help me how to write in single sql

    user632733 wrote:
    in your sql you are using lag to display from existing total_sal....which cant be possible in above scenario..??? Where did you see existing total_sal? EMP table:
    SQL> select deptno,ename,sal from emp
      2  /
        DEPTNO ENAME             SAL
            20 SMITH             800
            30 ALLEN            1600
            30 WARD             1250
            20 JONES            2975
            30 MARTIN           1250
            30 BLAKE            2850
            10 CLARK            2450
            20 SCOTT            3000
            10 KING             5000
            30 TURNER           1500
            20 ADAMS            1100
        DEPTNO ENAME             SAL
            30 JAMES             950
            20 FORD             3000
            10 MILLER           1300
    14 rows selected.
    SQL> As you can see, there are multiple employees in each department. Now look at mu solution. Inner select:
             select  deptno,
                     sum(sal) total_sal
               from  emp
               group by deptnosummarizes sal for each department. If you run it separately:
    SQL>          select  deptno,
      2                   sum(sal) total_sal
      3             from  emp
      4             group by deptno
      5  /
        DEPTNO  TOTAL_SAL
            30       9400
            20      10875
            10       8750
    SQL> Outer select calculates previous department total salary and its ratio to report.
    SY.
    P.S. And if you want to display individual employees along with department level summarization:
    select  deptno,
            ename,
            total_sal,
            prev_deptno,
            last_value(total_sal) over(order by deptno range between unbounded preceding and 1 preceding) prev_dept_total_sal,
            ratio_to_report(total_sal) over () * 100
      from  (
             select  deptno,
                     ename,
                     sum(sal) over(partition by deptno) total_sal,
                     max(deptno) over(order by deptno range between unbounded preceding and 1 preceding) prev_deptno
               from  emp
      order by deptno
        DEPTNO ENAME       TOTAL_SAL PREV_DEPTNO PREV_DEPT_TOTAL_SAL RATIO_TO_REPORT(TOTAL_SAL)OVER()*100
            10 MILLER           8750                                                           6.38569604
            10 KING             8750                                                           6.38569604
            10 CLARK            8750                                                           6.38569604
            20 ADAMS           10875          10                8750                           7.93650794
            20 FORD            10875          10                8750                           7.93650794
            20 JONES           10875          10                8750                           7.93650794
            20 SMITH           10875          10                8750                           7.93650794
            20 SCOTT           10875          10                8750                           7.93650794
            30 WARD             9400          20               10875                           6.86006203
            30 TURNER           9400          20               10875                           6.86006203
            30 ALLEN            9400          20               10875                           6.86006203
        DEPTNO ENAME       TOTAL_SAL PREV_DEPTNO PREV_DEPT_TOTAL_SAL RATIO_TO_REPORT(TOTAL_SAL)OVER()*100
            30 JAMES            9400          20               10875                           6.86006203
            30 BLAKE            9400          20               10875                           6.86006203
            30 MARTIN           9400          20               10875                           6.86006203
    14 rows selected.
    SQL>

  • Urgent Help Needed regd reading a file in apex

    Hi all,
    I need to know how can we store content of a file in a variable or any item(like text box).
    i have a os user name in the file.
    when i use apex_util.get_file it is opening in new page.
    instead i want it to stored in a text box or any variable.
    cany any one help me on this.
    Thanks in advance,
    Srini
    Message was edited by:
    user650963

    Hi Srini,
    You can use the normal file upload functionality to do this.
    1 - Create a page region and add in a File Browse item - I'll call it P1_FILE_NAME
    2 - Create a button in that region, I'll call it P1_UPLOAD_BUTTON, and set it to branch back to the same page
    3 - Create a TextArea item - I'll call it P1_FILE_CONTENTS
    4 - Create a page process, called P1_UPLOAD_FILE, and triggered by the P1_UPLOAD_BUTTON
    5 - Use the follownig code for the process:
    declare
    v_clob clob;
    v_blob blob;
    v_varchar2 varchar2(30000);
    BEGIN
    SELECT blob_content into v_blob FROM APEX_APPLICATION_FILES where name = :P1_FILE_NAME;
    v_clob := wwv_flow_utilities.blob_to_clob(v_blob,'utf-8');
    :P1_FILE_CONTENTS := wwv_flow_utilities.clob_to_varchar2(v_clob);
    :P1_FILE_NAME := '';
    delete from APEX_APPLICATION_FILES WHERE NAME = :P1_FILE_NAME;
    END;When you select the file and click the Upload button, the file is uploaded into the APEX_APPLICATION_FILES table. The contents of the file is put into a BLOB field. The above code, converts that BLOB into a CLOB and then into a VARCHAR2 value - you can then change P1_FILE_CONTENTS to that value. Finally, the code removes the file from the table and resets the File Browse field.
    Note that this assumes that the file contains nothing but text and is no more than 30,000 characters in length.
    Andy

  • Help Needed regarding SQL Loader Error

    Hi,
    I am trying to insert some records into two tables using same control file.
    I am using the follwing command to load data
    sqlload "$ORAUSER" CONTROL="$LDRFILE" DATA="$DATA_PATH/$DATA_FILE" BAD="$BAD_FILE" LOG="$LOG_FILE" DISCARD="$DISCARD_FILE" ERRORS="$MAX_ERRS"
    I am getting the error: SQL-LOADER - 350: Illegal combination of non-alphanumeric characters
    #!/bin/ksh
    Please suggest me what I need to do.
    Thanks,
    Srinivas.

    it appears that you are using this line code in your korn shell script. if you try to do a manual run on the unix command line do you still get the same error?
    also can you post a sample value for all the parameters you have.

  • Expert Help needed with Sql Loader !

    Hello Friends...I am using one .dat file that contains several values in a
    particular column and I need to load those values in different tables with
    sqlloader.....For example: in column 3 there are values 0001, 0004, 0007, 9999
    ..> values 0001 and 0004 need to be loaded into table1 and value 0007 is
    loaded into table2 and value 9999 needs to be loaded into table3.
    I can successfully use the when clause to load one value at a time but
    cannot load a range or multiple values during the sqlloader load. I can
    call and run separate .ctl files but less complexity and fewer files would
    be better. Tried everything I know but no luck, can't do loads in same
    .ctl file......Does the when clause have limitations whereby only one value
    at a time can evaluated as True or False ?
    I would like to do a Not or InBetween evaluations if possible on that
    single coulmn and then do the loads in the specific tables.
    Any help would be appreciated as I can see my hair turn grayer by the
    minute..My thanks in advance..

    You're asking sql*load to perform an unnatural act.
    Load in you dat file as-is. Create a pl/sql procedure to do the rest.
    Your batch script calls sql*load, then sql*plus to run the proc.
    Must simpler. sql*load is not a procedural language.

  • Help needed with SQL

    I have to create a join of two tables with the following fields:
    User_x
    Full_Name
    Login_Name
    Group_List
    Group_x
    Group_name
    Groupid
    In User_x table grouplist comprises of list of groups a user belongs to separated by a semi colon. e.g. 12;78;65
    Now I need to create a join where I get a list of all the users with the group they belong to.
    The result set should look like this
    User Groupname
    Tom Group1
    Peter Group2
    Kathy Group2
    and so on...
    Actual SQL wil be appreciated.
    Thanks

    Hi
    Try this:
    select use_name, group_name
    from user_x u, group_x g
    where instr(group_list, ';'||group_id||';') <> 0
    or substr(group_list, 1, instr(group_list, ';')-1) = group_id
    or substr(group_list, instr(group_list, ';', -1)+1) = group_id;
    Ott Karesz
    http://www.trendo-kft.hu

  • Help needed with sql long names

    i need help bringing in column names as the short name. currently my select statment is bringing in the sql longname. is there a way to bring in the short name specified in my db2 database. my code for my connection is as follows:
    driver      =(Driver) Class.forName "com.ibm.as400.access.AS400JDBCDriver");
    DriverManager.registerDriver(driver);
    conn = DriverManager.getConnection("jdbc:as400://system;date format=iso;", props);

    Try setting the sys property on the properties object.
    You can set a '.' or '/' for system or sql naming conventions!

  • Help needed on SQL

    Hi,
    I am attending few interviews I need some good quires to expertise SQL , I try to find them but not succeeded...can any one help me?
    Thanks and Regards
    Mahe

    Interview questions? some basic queries to start with would be:
    1. How to find duplicate rows in a table
    2. Delete all duplicate rows except 1
    3. Find top salary
    4. Find 3rd highest salary
    the list goes on and on.. mugging up the queries won't help.. you get expertise only if you work on actual scenarios...
    Anyways, best luck
    Aalap Sharma :)

  • Help needed in sql

    Hi,
    I am getting the filename as below and i want to extract some part of the string with the filename and the output need as below
    FileName : THE_PK_SOURCE_CLASS0002_PKID5403_20130603_342342.txt 
    Output:
    ======
    5403-THE_PK_SOURCE_CLASS0002_PKID5403
    Please help me in advance
    Thx,

    That's easy. Just mark the last two parts asa optional ({0,2})
    with data as (
    select 'THE_PK_SOURCE_CLASS0002_PKID5403_20130603_342342.txt' str from dual
    union all
    select '20130712-v1-THE_PK_SOURCE_CLASS0002_PKID5403_20130603_342342.txt' from dual
    union all
    select '20130712-v1-THE_PK_SOURCE_CLASS0002_PKID5403_1222.txt' from dual
    union all
    select '20130712-v1-THE_PK_SOURCE_CLASS0002_PKID5403.txt' from dual
    union all
    select '20130712-v1-THE_PK_SOURCE_CLASS0002_PKID5403_132.txt' from dual
    union all
    select '20130712-v1-THE_PK_SOURCE_CLASS0002_PKID5403_20130603_342342.txt' from dual
    select
    -- all from the start to and including the last hyphen is cut off
    regexp_replace(str, '^(.+-)?([^-]+?)(\d+)(_\d+){0,2}\.txt$', '\3-\2\3') str
    from data
    from data
    STR
    5403-THE_PK_SOURCE_CLASS0002_PKID5403
    5403-THE_PK_SOURCE_CLASS0002_PKID5403
    5403-THE_PK_SOURCE_CLASS0002_PKID5403
    5403-THE_PK_SOURCE_CLASS0002_PKID5403
    5403-THE_PK_SOURCE_CLASS0002_PKID5403
    5403-THE_PK_SOURCE_CLASS0002_PKID5403
    Message was edited by: chris227 Changed to the simplified version, but it's the same for the "corrected" veriosn too.

  • Help needed in SQL Loader

    Hi,
    Am using SQL Loader to insert rows in a table.
    I have 5 cols in table A. But the data is not present in all cols always.
    Have used TRAILING NULLCOLS but with no help.. few rows are inserted and for many others it throws "ORA-01841: (full) year must be between -4713 and +9999, and not be 0" error
    (because the value is null in that particular column position)
    How do I handle such cases.Please help asap.
    FYI -
    CONTROL FILE
    load data
    infile '/home/krkanth/test_spam_20070513.dat'
    BADFILE 'sample.bad'
    DISCARDFILE 'sample.dsc'
    into table spam_rule_stats
    fields terminated by "\t"
    optionally enclosed by '"'
    TRAILING NULLCOLS
    (MAIL_DATE date 'yyyymmdd hh24:mi:ss', METRIC_TYPE, HEURISTIC_TYPE, HEURISTIC_VALUE, REJECTION_COUNT,
    RULE_START_DATE DATE 'yyyymmdd hh24:mi:ss',
    RULE_END_DATE date 'yyyymmdd hh24:mi:ss',SOURCE)
    Am getting error Rejected - Error on table SPAM_RULE_STATS, column RULE_END_DATE.
    ORA-01841: (full) year must be between -4713 and +9999, and not be 0
    SAMPLE DATA
    20070513 RULE SENDER [email protected] 534 20070214 22:02:56
    SnA_ALERTS
    20070513 RULE SENDER [email protected] 6 20070503 21:19:36 200
    70518 21:19:36 RULE_EXTENSIONS
    20070513 RULE SENDER [email protected] 519 20061105 05:40:44 SnA
    _ALERTS
    20070513 RULE SENDER [email protected] 332 20070509 02:44:51 20070524 02
    :44:51 JASD_HP_AUTOREJECT
    20070513 RULE SENDER [email protected] 928 20070512 14:49:14 20070527 14:49:14 JAS
    D_HP_AUTOREJECT
    20070513 RULE SENDER [email protected] 19875 20070507 22:30:01 20070522 22
    :30:01 RULE_EXTENSIONS
    20070513 RULE SENDER [email protected] 3 20070509 09:08:38 20070524 09:08:38
    JASD_HP_AUTOREJECT
    20070513 RULE SENDER [email protected] 10 20070503 21:19:36 200
    70518 21:19:36 RULE_EXTENSIONS
    20070513 RULE SENDER [email protected] 4 20070506 04:39:48 20070521 04
    :39:48 JASD_HP_AUTOREJECT
    Thanks.

    not sure if this will work but you may want to give it a try:
      change from:
        (MAIL_DATE date 'yyyymmdd hh24:mi:ss'
      to:
        (MAIL_DATE date 'yyyymmdd'since the first data on your file does not have the timestamps

Maybe you are looking for

  • [SOLVED] How to configure prosody and jitsi to work together?

    Hi, I want to use prosody to connect several jitsi accounts on different computers on a LAN. I have followed the Prosody page in our wiki to set up Prosody and some user accounts. The service starts and ss -tul indicates that it is listening on the e

  • Need help in framing an SQL query

    Hi , Requirement is that Let's say I have a table say X I am passing two input params from UI and in DAO i am querying these input prams against the table X(has c1,c2 as columns ) (as it has two columns mapping the input params A,B from UI). if eithe

  • Button Pointing to audio file in same directory

    I'm fairly new to Flash, but have gotten the hang of it for the most part. I'm trying to create audio buttons that will play vocabulary words when clicked on for a language learning website. I can create buttons that play audio when clicked, but as o

  • Opening  Web Archive files in WebCT

    "This document is a Single File Web Page, also known as a Web Archive file. If you are seeing this message, your browser or editor doesn't support Web Archive files. Please download a browser that supports Web Archive, such as Microsoft Internet Expl

  • Please let me know that what is the operator in Thailand for my iPhone.

    Dear friendly, Please help me, I want to know that what is the operator in Thailand of my phone if you can check please tell me and for information of my iPhone as following. For operator in Thailand such as True Move, AIS, Dtac or Apple Thailand. iP