Why will a query work in SQL Developer but not in Apex?

Here's a good one. I created a dynamic LOV with the following query.
select
e.DESCR d,
ee.ENTRD_EVNT_SK r
from
PT_EVNT_IN_DIV eid,
PT_ENTRD_EVNT ee,
PT_EVNT e
where ee.PGNT_SK = :PGNT_SK
and ee.CNTSNT_SK = :CNTSNT_SK
and ee.EVNT_IN_DIV_SK = eid.EVNT_IN_DIV_SK
and eid.EVNT_SK = e.EVNT_SK
and ee.ENTRD_EVNT_SK not in
(select js.ENTRD_EVNT_SK
from PT_JDG_SCR js
where js.JDG_SK = :JDG_SK
and js.PGNT_SK = :ai_pgnt_sk
and js.CNTSNT_SK = :CNTSNT_SK)
order by 1
The query works fine in SQL Developer, but Apex gives the following error when compiling it in the LOV editor.
"1 error has occurred
- LOV query is invalid, a display and a return value are needed, the column names need to be different. If your query contains an in-line query, the first FROM clause in the SQL statement must not belong to the in-line query."
I tried rearranging the entries in the From clause, but that didn't do any good.
Do you see what I can do to make Apex accept it?
Thanks,
Kim

Kim
Kim2012 wrote:
select
e.DESCR d,
ee.ENTRD_EVNT_SK r
from
PT_EVNT_IN_DIV eid,
PT_ENTRD_EVNT ee,
PT_EVNT e
where ee.PGNT_SK = :PGNT_SK
and ee.CNTSNT_SK = :CNTSNT_SK
and ee.EVNT_IN_DIV_SK = eid.EVNT_IN_DIV_SK
and eid.EVNT_SK = e.EVNT_SK
and ee.ENTRD_EVNT_SK not in
(select js.ENTRD_EVNT_SK
from PT_JDG_SCR js
where js.JDG_SK = :JDG_SK
and js.PGNT_SK = :ai_pgnt_sk
and js.CNTSNT_SK = :CNTSNT_SK)
order by 1
The column named ENTRD_EVNT_SK is used twice in a select. Once in the main select and once in the inline query.
The validation maybe choking on that.
Try giving the column in the inline query an alias and see if that helps.
Nicolette

Similar Messages

  • Why does the query work in SQL Developer, but not in APEX?

    Hi, guys:
    I have a silly question. I have a complicated query, and I tested it successfully with SQL developer, and result is correct. However, when I put it into APEX to generate a report, it always reports no data found. I also know the condition related to "other marks" select list in the where clause part causes this problem. It also looks strange: before I add this condition, everything works OK; after I add this condition, even I do not choose the "other marks" select list, other components do not work neither. I always got no data found result. Could anyone help me on this problem? You can also visit our developing site as http://lsg-solutions.com:8888/apex/f?p=206 to check the problem.
    Thanks a lot
    Sam
    select distinct 'MAP','Detail',so.doc_number as "DOC Number", so.offender_id as "Offender ID", so.first_name||' '|| so.middle_name||' '||so.last_name as "Offender Name",
    so.date_of_birth as "Date of Birth",
    (select sc1.description from sor_code sc1 where sc1.code_id=so.race) as "Race",
    (select sc2.description from sor_code sc2 where sc2.code_id=so.sex) as "Sex",
    (select sc8.description from sor_code sc8 where sc8.code_id=so.hair_color) as "Hair Color",
    (select sc9.description from sor_code sc9 where sc9.code_id=so.eye_color) as "Eye Color",
    replace(replace(nvl2(sl.address1, sl.address1||' '||sl.address2 ||' '||sl.city ||' '||sl.county||' '||(select sc3.description from sor_code sc3 where sc3.code_id=sl.state)||' '||sl.zip, 'No Known Address'),'#'),',') as "Address",
    replace(replace(nvl2(sl.physical_address1,sl.physical_address1||' '||sl.physical_city ||' '||sl.physical_county||' '||(select sc4.description from sor_code sc4 where sc4.code_id=sl.physical_state)||' '||sl.physical_zip, 'No Known Address'),'#'),',') as "Physical Address",
    sl.status as "Status",
    sl.jurisdiction as "Jurisdiction",
    to_char(sl.ADDRESS_LATITUDE) as "Address Latitude",to_char(sl.address_longitude) as "Address Longitude",
    to_char(sl.physical_address_latitude) as "Physical Latitude",to_char(sl.physical_address_Longitude) as "Physical Longitude",
    decode(rox.habitual, 'Y', 'Habitual', '') as "Habitual",
    decode(rox.aggravated, 'Y', 'Aggravated', '') as "Aggravated",
    rox.status as "Registration Status",
    rox.registration_date as "Registration Date",
    rox.end_registration_date as "End Registration Date"
    from sor_location sl, sor_offender so, registration_offender_xref rox, sor_last_locn_v sllv
    where rox.offender_id=so.offender_id
    and sllv.offender_id(+)=so.offender_id
    and sl.location_id(+)=sllv.location_id
    and rox.status not in ('Merged')
    and rox.reg_type_id=1
    and upper(rox.status)='ACTIVE'
    and nvl(rox.admin_validated, to_date(1,'J'))>=nvl(rox.entry_date, to_date(1,'J'))
    and (((select sc11.description from sor_code sc11 where sc11.code_id=so.race and sc11.description=:P5_SL_RACE) is not null ) or (:P5_SL_RACE is null))
    and (((select sc12.description from sor_code sc12 where sc12.code_id=so.sex and sc12.description=:P5_SL_SEX) is not null ) or (:P5_SL_SEX is null))
    and (((select sc13.description from sor_code sc13 where sc13.code_id=so.hair_color and sc13.description=:P5_SL_HAIR_COLOR) is not null ) or (:P5_SL_HAIR_COLOR is null))
    and (((select sc14.description from sor_code sc14 where sc14.code_id=so.eye_color and sc14.description=:P5_SL_EYE_COLOR) is not null ) or (:P5_SL_EYE_COLOR is null))
    and (( so.offender_id in(select sm.offender_id from sor_code sc15, sor_mark sm, sor_offender so1 where sm.offender_id=so1.offender_id and sc15.code_id=sm.code and sc15.description=:P5_SL_OTHER_MARKS and sm.description is not null)) or (:P5_SL_OTHER_MARKS is null))

    My suggestion would be to put some instrumentation into your query and see what values you are using.. Or even simpler take out ALL the where clauses you can until data starts to sho wup and then add them back in one at a time until you find the culprit..
    My bet would be on any date comparisons you are doing between page items and database columns..
    Thank you,
    Tony Miller
    Dallas, TX

  • Query works in SQL Developer but not in APEX

    The query below runs fine in SQL Developer. I have tried entering it both as a Report Region based on SQL Query and in a Dynamic PL/SQL Region. I get different error messages in each. In the Dynamic PL/SQL Region I get the error that an INTO clause is expected in the select
    statement. When I place it in a Report based on SQL query I get an error that there is an invalid column and to use column alias. What I am attempting to do is add the first query result to the second query result.
    Select (select count(lead_id) from t3_leads
    WHERE
    t3_leads.market_id = 'Gurnee'
    AND (T3_Leads.Last_Campaign = 'Hand Addressed' OR T3_Leads.Last_Campaign is null)
    AND
    ((TRUNC(sysdate) - TRUNC(T3_Leads.LAST_MAILED_DATE)) > 60
    OR T3_Leads.Last_Mailed_Date is null))
    +
    (select count(lead_id)from t3_leads where zip in (select zip from t3_overlap where t3_leads.zip = t3_overlap.zip)
    and
    market_id <> 'Gurnee'
    and ((TRUNC(sysdate) - TRUNC(T3_Leads.LAST_MAILED_DATE)) > 60
    OR T3_Leads.Last_Mailed_Date is null))
    from dual

    Hi,
    you need a column alias for your "result" before the final 'from dual':
    Select (select count(lead_id) from t3_leads
    WHERE
    t3_leads.market_id = 'Gurnee'
    AND (T3_Leads.Last_Campaign = 'Hand Addressed' OR T3_Leads.Last_Campaign is null)
    AND
    ((TRUNC(sysdate) - TRUNC(T3_Leads.LAST_MAILED_DATE)) > 60
    OR T3_Leads.Last_Mailed_Date is null))
    +
    (select count(lead_id)from t3_leads where zip in (select zip from t3_overlap where t3_leads.zip = t3_overlap.zip)
    and
    market_id 'Gurnee'
    and ((TRUNC(sysdate) - TRUNC(T3_Leads.LAST_MAILED_DATE)) > 60
    OR T3_Leads.Last_Mailed_Date is null)) result
    from dualPlease let me know if this works.
    Thanks
    Sandro

  • Can we keep APEX open? Query works in SQL Developer but not Oracle APEX

    Hi Sirini,
    Just my thoughts -- but if one of these is closed, I think it should be the other one {thread:id=2496751} where he's getting the run-around. This one {thread:id=2496754} (APEX!) should be the one kept open. Don't you think?
    My 2 cents,
    Howard

    ..where he's getting the run-around...What runaround? The posters there determined that he needed a semi-colon at the end of the statement and then that he had forgotten the INTO clause. Both are beginner errors. OP has closed the thread as answered and has gone 'off to Google' to learn more about creating SQL queries in PL/SQL. This seems resolved -- at least until he comes back from his Googlequest with another question.

  • Query works in SQL Developer but not in Oracle APEX

    The query below runs and produces the correct result in SQL Developer, but when I try to put it into a PL/SQL process in Apex I get the error shown. There is no semi-colon at the end of the query in APEX.
    The error is:
    ORA-06550: line 10, column 54: PL/SQL: ORA-00933: SQL command not properly ended ORA-06550: line 2, column 1: PL/SQL: SQL Statement ignored ORA-06550: line 11, column 21: PLS-00103: Encountered the symbol "end-of-file" when expecting one of the following: ( begin case declare end exception exit for goto if loop mod null pragma raise return select update while with.
    The query is:
    SELECT *
    FROM
    (SELECT *
    from T3_LEADS
    WHERE
    (SYSDATE - Last_Mailed_Date) > 60 OR Last_Mailed_Date is null
    WHERE MARKET_ID = 'Salt_Lake_City' AND rownum <= 100

    That is because when you run a SQL in SQL*Plus or SQLDeveloper the output is displayed on the screen, but in Apex you need to select those values into variables so you can do something with the data.
    delcare
      v_emp_id    employee.emp_id%type;
    begin
      select emp_id
        into v_emp_id
        from employee
      where lname = 'JOHNSON' and fname = 'BILLY';
      -- Then do something with that data
      if v_emp_id between 1 and 10 then
      end if;
    end;Probably a bad SQL for an example. For your SQL though, you are selecting * which you would be able to select into a rowtype variable, but you are probably going to start having problems like "Exact fetch returns more that one row" since your query will probably return more that one value. In those cases you want to use cursors, and loop through the data one record at a time. You can Google all of that.

  • SQL Query works in SQL Developer, but not always in MII

    Hi all,
    I encountered a strange behaviour with a query in MII 12.0.2. Maybe someone has a guess what happens.
    I have created a SQL query which runs against Oracle 10g tables. I have tested the query using SQL Developer, and it throws a couple of lines, depending on the contents of the where clause.
    Next I have copied the query to a MII SQL Query (FixedQuery). However, the output is empty most of the time, without showing any errors. After some testing I got the impression that older data are not displayed, but there is no time or date setting in MII.
    As the SQL Developer always returns rows, I am unsure where to search for the error.
    Regards
    Michael

    Michael,
    I would imagine that you have sub-select statements in your FixedQuery, all which will fall subject to the RowCount property of the query template (SQL defaults to 100), which is issued through the driver and typically honored by the database when returning the data from your request.
    Most of the native database query tools allow you to make unbound query requests with no limit on rows, which would probably account for the difference between SQL Developer and the query template.
    For SQLServer it's ROWCOUNT:  http://msdn.microsoft.com/en-us/library/ms188774.aspx
    For Oracle it's ROWNUM:  http://www.oracle.com/technology/oramag/oracle/06-sep/o56asktom.html
    So the answer would be not to make the query template row count some rediculous number, but more appropriately refine the way that the database request is issued.
    Regards,
    Jeremy

  • SQL script works in SQL Developer but not when scheduled

    I have a script that I can run, logged onto my server as a user with full permissions and into my database as SYSDBA, that produces a CSV file on the server when I run it from SQL Developer ON the server. HOWEVER, when I set it up as a scheduled job, using those SAME CREDENTIALS (same Windows/network user; same database user), I get no output. The job indicates that it's running successfully, but no file gets created.
    Any advice is greatly appreciated.
    Here's the script:
    WHENEVER SQLERROR EXIT FAILURE;
         set serveroutput on
         DECLARE
         my_query varchar2(5000);
         BEGIN
         my_query := q'[
    SELECT client_id, JOB_NAME, SCHEDULE_TYPE, TO_CHAR(START_DATE,'MM/DD/YYYY HH24:MM') AS START_DATE,
    REPEAT_INTERVAL, ENABLED, STATE, RUN_COUNT,
    TO_CHAR(LAST_START_DATE,'MM/DD/YYYY HH24:MM') AS LAST_START, LAST_RUN_DURATION,
    TO_CHAR(NEXT_RUN_DATE,'MM/DD/YYYY HH24:MM') AS NEXT_RUN
    FROM DBA_SCHEDULER_JOBS
    WHERE instr(client_id,'10.') is not null
    ORDER BY LAST_START_DATE DESC
         p2k.ccsd_any_query_to_csv('HRISEDB_E_OUTPUT_MK', 'dbserver_job_output.csv',my_query);
         end;
    =================================================================
    Here's the called procedure (I don't really understand it -- I gleaned it from others on the internet):
    -- DDL for Procedure CCSD_ANY_QUERY_TO_CSV
    set define off;
    CREATE OR REPLACE PROCEDURE "CCSD_ANY_QUERY_TO_CSV" (p_dir in varchar2, p_filename in varchar2, p_query in varchar2) AUTHID CURRENT_USER
    is
    l_output utl_file.file_type;
    l_theCursor integer default dbms_sql.open_cursor;
    l_columnValue varchar2(4000);
    l_status integer;
    l_query long;
    l_colCnt number := 0;
    l_separator varchar2(1);
    l_col_desc dbms_sql.desc_tab;
    l_col_type varchar2(30);
    l_datevar varchar2(8);
    BEGIN
    l_query := 'SELECT SYSDATE FROM DUAL; ';
    dbms_sql.parse(l_theCursor, p_query, dbms_sql.native);
    dbms_sql.describe_columns(l_theCursor, l_colCnt, l_col_desc);
    l_output := utl_file.fopen( p_dir, p_filename, 'w' );
    dbms_sql.parse( l_theCursor, p_query, dbms_sql.native );
    for i in 1..l_col_desc.count LOOP
    utl_file.put( l_output, l_separator || '"' || l_col_desc(i).col_name || '"' );
    dbms_sql.define_column( l_theCursor, i, l_columnValue, 4000 );
    l_separator := ',';
    end loop;
    utl_file.new_line( l_output );
    l_status := dbms_sql.execute(l_theCursor);
    while ( dbms_sql.fetch_rows(l_theCursor) > 0 ) loop
    l_separator := '';
    for i in 1 .. l_colCnt loop
    dbms_sql.column_value( l_theCursor, i, l_columnValue );
    utl_file.put( l_output, l_separator || '"' || l_columnValue || '"');
    l_separator := ',';
    end loop;
    utl_file.new_line( l_output );
    end loop;
    dbms_sql.close_cursor(l_theCursor);
    utl_file.fclose( l_output );
    execute immediate 'alter session set nls_date_format=''dd-MON-yy'' ';
    exception
    when others then
    execute immediate 'alter session set nls_date_format=''dd-MON-yy'' ';
    raise;
    end;
    /

    hello,
    does oracle showing any errors in user_scheduler_job_run_details for this job ? I would advise try inserting some debug statement to identify where exactly its stuck. Also please check sample configurations syntax for user_scheduler_jobs.
    Cheers
    Sush

  • Form auto query works in 10g developer, but not when served by forms server

    I have a form with a master and two detail blocks on the same canvas. When I run it from the developer tool on my desktop, it works great, the master block populates as expected based on the GO_BLOCK and EXECUTE_QUERY statements, and the detail blocks both populate automatically, firing their POST_QUERY triggers as well. When I run it on the server, I have to execute query manually, and then navigate to each of the detail blocks and then execute their queries manually too. When I do that, their POST_QUERY triggers are not firing.
    Desktop is (Windows XP Professional version 5.1 build 2600.xpsp_sp3_gdr.100427-1636 : Service Pack 3)
    Developer version is Forms [32 Bit] Version 10.1.2.0.2 (Production)
    Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit Production
    With the Partitioning, OLAP, Data Mining and Real Application Testing options
    Oracle Toolkit Version 10.1.2.0.2 (Production)
    PL/SQL Version 10.1.0.4.2 (Production)
    Oracle Procedure Builder V10.1.2.0.2 - Production
    PL/SQL Editor (c) WinMain Software (www.winmain.com), v1.0 (Production)
    Oracle Query Builder 10.1.2.0.2 - Production
    Oracle Virtual Graphics System Version 10.1.2.0.2 (Production)
    Oracle Tools GUI Utilities Version 10.1.2.0.2 (Production)
    Oracle Multimedia Version 10.1.2.0.2 (Production)
    Oracle Tools Integration Version 10.1.2.0.2 (Production)
    Oracle Tools Common Area Version 10.1.2.0.2
    Oracle CORE     10.1.0.4.0     Production
    Server version is OAS forms/reports install – 10.1.2.3
    OS – x86-64bit (Red Hat Enterprise Linux Server release 5.4)

    hello,
    does oracle showing any errors in user_scheduler_job_run_details for this job ? I would advise try inserting some debug statement to identify where exactly its stuck. Also please check sample configurations syntax for user_scheduler_jobs.
    Cheers
    Sush

  • Why will iTunes Match work on my iPhone, but not on my MB Pro?

    I have an annual Match subscription which I downloaded onto my MacBook.  I then enable Match on my iPhone and it works properly.  However, when I try to turn Match ON on my MacBook, it displays an ad asking me to subscribe again.  I can play the iTunes Radio just fine, except for the commercials, which is why I subscribed to Match in the first place.  I'm sure there's a step I'm missing somewhere.  Any help is appreciated.

    Hi,
    Have you signed into iTunes using same Apple ID before turning on match on your computer?
    Did you subscribe to match from your iPhone or your computer?
    Jim

  • SQL works in SQL workshop but not in APEX

    Hi All,
    I'm trying some sample sql to get around the 32k limit in APEX and even though the sql works in SQLWorkshop, when I use it as a source for textarea object in APEX I get an error. Here's the SQL:
    declare
    l_code clob := empty_clob;
    l_clob_source2 clob;
    offset int:=1;
    begin
         select replace("CHNL_PRTNR_XML_TRAN"."XML_TRAN", '<', '<') into l_code from "CHNL_PRTNR_XML_TRAN" where "CHNL_PRTNR_XML_TRAN"."VITRIA_DROP_OFF_SEQ_ID" = :P2_TRAN_ID;
    loop
    l_clob_source2 := dbms_lob.substr(l_code,4000,offset);
    htp.prn(l_clob_source2);
    exit when offset + 4000 >= nvl(dbms_lob.getlength (l_code),0);
    offset := offset + 4000;
    end loop;
    end;
    Here's the error message I get APEX:
    ORA-06550: line 13, column 17: PLS-00103: Encountered the symbol "end-of-file" when expecting one of the following: ; The symbol ";" was substituted for "end-of-file" to continue.
    Error ERR-1019 Error computing item default value: page=2 name=P2_XMLTRAN.

    Try to set it to SQL Query (PL/SQL-Functions Body), then it should work

  • Connection ... able to connect using sql developer, but not sqlplus or toad too

    Hi folks, having this issue, with only one of my so many databases, what might be the reason and how to fix/correct this, please assist.
    Able to connect using sql developer, but not sqlplus or toad too; sqlplus error: ORA-12154: TNS:could not resolve the connect identifier specified
    thanks in advance.

    SQLDEVELOPER works since it use JDBC Thin & does not use tnsnames.ora
    ORA-12154 ALWAYS only occurs on SQL Client & no SQL*Net packets ever leave client system
    ORA-12154 [B]NEVER[/B] involves the listener, the database itself or anything on the DB Server.
    ORA-12154 occurs when client requests a connection to some DB server system using some connection string.
    TNS-03505 is thrown by tnsping & is same error as ORA-12154 thrown by sqlplus or others.
    The lookup operation fails because the name provided can [B]NOT[/B] be resolved to any remote DB.
    The analogous operation would be when you wanted to call somebody, but could not find their name in any phonebook.
    The most frequent cause for the ORA-12154  error is when the connection alias can not be found in tnsnames.ora.
    The lookup operation of the alias can be impacted by the contents of the sqlnet.ora file; specifically DOMAIN entry.
    TROUBLESHOOTING GUIDE: ORA-12154 & TNS-12154 TNS:could not resolve service name [ID 114085.1]
    http://edstevensdba.wordpress.com/2011/02/26/ora-12154tns-03505/

  • Query returns record in SQL Developer but not in iSQLPlus

    ... back in a minute, I may not have done a commit at the end of the insert.
    The problem I was having was I hadnt commited the record in SQL Developer but the queries where returning records in this environment but not in iSQLPlus or Apex and it was confusing me.
    Message was edited by:
    Benton
    Message was edited by:
    Benton

    Finally got to know the reason why Timezone Abbr woudn't show up in SQL Plus.
    I ran below query in SQL PLUS
    SELECT SESSIONTIMEZONE, CURRENT_TIMESTAMP, systimestamp, LOCALTIMESTAMP FROM DUAL;
    SESSIONTIMEZONE CURRENT_TIMESTAMP SYSTIMESTAMP LOCALTIMESTAMP
    -05:00 08-SEP-12 12.00.31.575228 AM -05:00 08-SEP-12 12.00.31.575223 AM -05:00 08-SEP-12 12.00.31.575228 AM
    Now executed the same query in SQL Developer:
    SESSIONTIMEZONE CURRENT_TIMESTAMP SYSTIMESTAMP LOCALTIMESTAMP
    America/Chicago     08-SEP-12 12.08.32.072424000 AM AMERICA/CHICAGO     08-SEP-12 12.08.32.072420000 AM -05:00     08-SEP-12 12.08.32.072424000 AM
    The difference between the 2 outputs is the way in which time_zones were respresented. In SQL PLUS, it is shown as an offset whereas in SQL Developer as a time zone region name. Now there are many "time sone regions" that follow an offset of -5:00. This confuses Oracle and a "UNK"(Unknown) for a query like the one below when trying to execute in SQL PLUS:
    select extract(timezone_abbr from from_tz(cast(sysdate as timestamp),SESSIONTIMEZONE)) from dual;
    EXTRACT(TI
    UNK
    Therefore we need to specify the exact Time Zone Region(TZR) in order to obtain the corresponding TZD(Daylight Savings Format i.e. CDT or CST). This we do by altering the session environment vaiable time_zone
    alter session set time_zone='America/Chicago';
    Now executing the queries to find the abbreviated time zone( in TZD format) will finally work to return a non-null char value.
    select extract(timezone_abbr from from_tz(cast(sysdate as timestamp),SESSIONTIMEZONE)) from dual;
    EXTRACT(TI
    CDT
    select to_char(CURRENT_TIMESTAMP, 'TZD') from dual;
    TO_CHA
    CDT

  • Inner Query is excuting properly in 10g SQL developer, but not in Form 6i

    Hi All,
    I am able to excute below query in Oracle SQL developer in 10g , but when I tried to excute it in Forms 6i on WHEN-NEW-FORM_INSTANCE trigger, it is giving me below error message
    SELECT okl2.line_number subline_number, okl2.sts_code subline_status,
    okl2.start_date subline_start_date, okl2.end_date subline_end_date,
    okl2.date_terminated,oks.cognomen line_ref,okl2.ID subline_id,okl2.lse_id,
    (SELECT orig_model_no
    FROM apps.emcoks_msh_subst_models sm
    WHERE okh.contract_number = sm.contract_number
    AND okl.line_number = record_line_id) orig_model_no,
    (SELECT orig_model_qty
    FROM apps.emcoks_msh_subst_models sm
    WHERE okh.contract_number = sm.contract_number
    AND okl.line_number = record_line_id) orig_model_qty
    FROM apps.okc_k_lines_b okl2,
    apps.okc_k_headers_b okh,
    apps.okc_k_lines_b okl,
    apps.okc_k_items oki ,
    apps.okc_k_lines_tl oks
    WHERE 1 = 1
    AND okl2.dnz_chr_id = okl.chr_id
    AND okl.lse_id = 1
    AND okl2.lse_id IN (7, 9)
    AND okl.ID = okl2.cle_id
    AND okl.ID = oki.cle_id
    AND okl2.ID = oks.ID
    AND okl.chr_id = okh.ID
    AND okl2.dnz_chr_id = okh.ID
    AND okl.ID = 130246066126590818122526020119476052469
    order by subline_id;
    Error 103 : Encountered the symbol "Select" when expecting one of the following
    ( - + mod not null others <an identifier>

    I am new to Oracle Forms. Could you please guide me, how to create this statement as a view in the database ?
    I have tried to rewrite it using OUTER JOIN, but I am not getting same results.
    SELECT okl.line_number subline_number, okl.sts_code subline_status,
    okl.start_date subline_start_date, okl.end_date subline_end_date,
    okl.date_terminated,oks.cognomen line_ref,okl.ID subline_id,okl.lse_id,
    sm.orig_model_no orig_model_no,
    sm.orig_model_qty orig_model_qty
    FROM apps.okc_k_lines_b okl2,
    apps.okc_k_headers_b okh,
    apps.okc_k_lines_b okl,
    apps.okc_k_items oki ,
         apps.okc_k_lines_tl oks
    , apps.emcoks_msh_subst_models sm
    WHERE 1 = 1
    AND okl2.dnz_chr_id = okl.chr_id
    AND okl.lse_id = 1
    AND okl2.lse_id IN (7, 9)
    AND okl.ID = okl2.cle_id
    AND okl.ID = oki.cle_id
    AND okl2.ID = oks.ID
    AND okl.chr_id = okh.ID
    AND okl2.dnz_chr_id = okh.ID
    AND okl.ID = 130246066126590818122526020119476052469
    AND okh.contract_number (+) = sm.contract_number
    AND okl.line_number (+) = sm.record_line_id
    order by subline_id;
    Edited by: Swarup_C on May 8, 2013 6:46 AM

  • Code runs correctly when compiled by SQL developer but not SQL Plus

    I have a rather large package body I need to deploy and compile ... It's big and complex (I inherited the project). Our it dept is huge and scripts are deployed by the dba team and they seem to only use sql plus. My code deploys and runs fine when compiled in sql developer. Once I compile it from SQL plus it stops working. It runs and using debug statements I can see the values are correct but it no longer inserts the data into the proper tables. I get ZERO errors or warnings when this is compiled in SQL Plus and no errors are generated from the code at run time. I've diffed the extracts of the code from the DB after each deployment and the only difference is the blank lines which SQL Plus strips out when you load the file. Has anyone run into anything remotely similar and if so how did you solve it? I've tried modifying the code to no avail, adding in comments to preserve the white space makes no difference. The thing that really kills me is that there is no error at all.

    Ok this is the problem area.... vReplyMessage is a clob. I've replaced it in this section of processing with a varchar2(32000). And now it works. I still would like to know why though. Nothing is changed when I load it though sqlplus or sql developer but this line " update swn_recip_response_t set SWN_RECIP_RESPONSE = vTextReply where notification_id = v_notification_id; " would never execute with the clob. Logging showed that the clob had the correct value though. I am puzzled.
    begin
    call_SWNPost('http://www.sendwordnow.com/usps/getNotificationResults',vMessageText, vReplyMessage, v_status_code, v_status_phrase, '');
    exception
    when others then
    raise eJavaException;
    end;
    vTextReply := dbms_lob.substr( vReplyMessage, 32000, 1 );
    if (vDebug) then
    update PEMS_PROD_2.SWN_POST_LOG set response = 'notif_id == '|| v_notification_id || 'status code == '|| v_status_code|| ' '||vTextReply where log_pk = vLogPK;
    commit;
    end if;
    IF v_status_code = 200 then
    v_has_error := 'N';
    ELSE
    v_has_error := 'Y';
    END IF;
    -- we handle all exceptions below in case something goes wrong here.
    -- this area can die silently.
    vTextReply := replace(vTextReply,'<getNotificationResultsResponse xmlns="http://www.sendwordnow.com/usps">', '<getNotificationResultsResponse xmlns:xyz="http://www.sendwordnow.com/usps">');
    begin
    insert into swn_recip_response_t(notification_id) values (v_notification_id);
    exception
    when others then
    if (vDebug) then
    err_num := SQLCODE;
    err_msg := SUBSTR(SQLERRM, 1, 100);
    insert into PEMS_PROD_2.SWN_POST_LOG (LOG_PK, create_date, REQUEST, notification_id) values(pems_prod_2.swn_post_log_seq.nextval,sysdate,
    'err_num - '||to_char(err_num)|| ' error_msg - '|| err_msg, v_notification_id);
    commit;
    else
    null;
    end if;
    end;
    commit;
    begin
    update swn_recip_response_t
    set SWN_RECIP_RESPONSE = vTextReply
    where notification_id = v_notification_id;
    exception
    when others then
    if (vDebug) then
    err_num := SQLCODE;
    err_msg := SUBSTR(SQLERRM, 1, 100);
    insert into PEMS_PROD_2.SWN_POST_LOG (log_pk, create_date, REQUEST, notification_id) values(pems_prod_2.swn_post_log_seq.nextval,sysdate,
    'err_num - '||to_char(err_num)|| ' error_msg - '|| err_msg, v_notification_id);
    commit;
    else
    null;
    end if;
    end;
    commit;
    -- parse through the XML document and update the notification and recipient records
    -- parse the clob into an xml dom object
    begin
    vReplyMessage := vTextReply;
    ...

  • Able to connect via Oracle SQL Developer, but not sql plus

    Using Oracle 10.2.0.
    I can connect using the TNS connection type in SQL Developer, but cannot do so in SQL PLUS. SQL Plus gives me the error -- could not resolve the connect identifier.
    When I do tnsping USPO_ADHOC, I get:
    C:\oracle\product\10.2.0\client_1\network\admin\sqlnet.ora
    Used TNSNAMES adapter to resolve the alias
    Attempting to contact (DESCRIPTION =
    TNS-12533: TNS:illegal ADDRESS parameters
    So here is my tnsnames.ora file:
    INTL_ADHOC =
    (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 10.239.162.108)(PORT = 1521))
    (CONNECT_DATA =
    (SID = intl1)
    USSYN_ADHOC =
    (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 10.239.162.109)(PORT = 1521))
    (CONNECT_DATA =
    (SID = USSYN)
    USPO_ADHOC =
    (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 10.239.162.107)(PORT = 1521))
    (CONNECT_DATA =
    (SID = uspo)
    Any assistance gratefully appreciated. Thanks.

    I actually did not have that environmental variable, so I added it, but nothing changed.
    I would note that if I do tnsping foo, I get: failed to resolve name.
    If I do tnsping USPO_ADHOC, I get: illegal address parameter.
    In both cases, the output correctly identified the path to my sqlnet.ora file, which is in the same directory as my tnsnames.
    So I would conclude from that, that the system was already able to find my tnsnames file.
    Anyway, here's my sqlnet.ora:
    SQLNET.AUTHENTICATION_SERVICES= (NTS)
    NAMES.DIRECTORY_PATH= (TNSNAMES, EZCONNECT)
    Thanks again for any ideas!

Maybe you are looking for

  • How can I use iCloud on OS 4.2.1? Manual Setup?

    I have a iPhone 3G and I use iCloud. I've problems to set up my account, there is only "mobile me" possible. Is there any possibility to set up the mail, contacts and calender manually? Thank you for your help.

  • Mac OS 10.8.4 slows down and freezes

    Hi, I am running Mac OS X Mountain Lion with the newest updates. Since 4 Weeks I am receiving error messages like this one: WindowServer[112]: CGXDisableUpdate: UI updates were forcibly disabled by application "Chrome" for over 1.00 seconds. Server h

  • Created a trigger but new values are not inserting in the backup table

    I have created a backup table and writter a trigger on a table such that after update old values and new values are to be inserted into the backup table, but new values are not inserting. I am giving the code please help me create or replace trigger

  • ITunes does not import certain files

    Hi everyone, I had to reinstall my WinXP system and therefore also reinstalled iTunes (v9.0.3.15). Now, when I imported my whole MP3 directory, iTunes did not import some albums without displaying any error message. When I realized that some albums a

  • WDS??????

    what is WDS? i get an error on my WLSE server saying ""AP is not registered with any WDS"" Do i need a WDS? If so could anyone send me to a good link about setting up a WDS........Thanks! James