Formatting sqlplus

Dear all,
Below query in sqlplus returns the output in 2 rows . I want the output to be in the same row
select DISTINCT ORIGINATING_TIMESTAMP,MESSAGE_TEXT from sys.X$DBGALERTEXT WHERE MESSAGE_TEXT LIKE 'ORA-%' or MESSAGE_TEXT LIKE '%Fatal%' AND ORIGINATING_TIMESTAMP > SYSDATE-4;
sample output :
28-APR-10 07.03.29.925 PM +03:00
ORA-28 : opiodr aborting process unknown ospid (18707_1)
I tried using set linesize and column format also. but, the output is not displaying in single row
Any idea what I need to set
Kai

KaiS wrote:
Dear all,
Below query in sqlplus returns the output in 2 rows . I want the output to be in the same row
select DISTINCT ORIGINATING_TIMESTAMP,MESSAGE_TEXT from sys.X$DBGALERTEXT WHERE MESSAGE_TEXT LIKE 'ORA-%' or MESSAGE_TEXT LIKE '%Fatal%' AND ORIGINATING_TIMESTAMP > SYSDATE-4;
sample output :
28-APR-10 07.03.29.925 PM +03:00
ORA-28 : opiodr aborting process unknown ospid (18707_1)
I tried using set linesize and column format also. but, the output is not displaying in single row
Any idea what I need to set
KaiThere is actually a forum for SQL*PLUS, but it doesn't get much traffic (frowny emoticon following will probably not appear) :(
Assuming that the output in your example is the message and not an error that you are asking for help with you can use the FOLD_AFTER command to force columns to appear on different lines, something like
column one fold_after
select 1 one, 2 two
  from dual;
one
two
         1
         2you can get better appearance by turning headings off
Edited by: riedelme on Jun 27, 2011 12:50 PM
oops, op wanted to eliminate the folding, not force it

Similar Messages

  • How to format sqlplus output

    In previous OTN Forum format we used {code} to format sqlplus output , how to do in this version ?

    Click on "Use Advanced Editor".
    Highlight your code.
    Click on the symbol >>
    Select Syntax Highlighting
    Select SQL...output looks like below:
    select sysdate from dual;

  • FORMATTING SQLPLUS OUTPUT

    I am running a shell script
    shell script
    #!/bin/sh
    sqlplus /nolog <<EOF>/ora01/file1
    CONNECT aaa/bbb@abc
    select table_name from user_tables;
    exit
    EOF
    output
    SQL*Plus: Release 10.2.0.1.0 - Production on Thu Sep 13 17:01:53 2007
    Copyright (c) 1982, 2005, Oracle. All rights reserved.
    SQL> Connected.
    SQL> SQL> SQL> SQL> SQL>
    COUNTRIES
    REGIONS
    JOBS
    JOB_HISTORY
    EMPLOYEES
    DEPARTMENTS
    LOCATIONS
    SQL> SQL> Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
    With the Partitioning, OLAP and Data Mining options
    desired result
    COUNTRIES
    REGIONS
    JOBS
    JOB_HISTORY
    EMPLOYEES
    DEPARTMENTS
    LOCATIONS
    how can i format my sqlplus output so that my desired result is as above.
    Thanks!

    Yes, this seem to work, however, only if connect is done not from within sqlplus but from the shell prompt.
    ~ >cat s.sh
    #!/bin/sh
    sqlplus -s scott/tiger <<EOF
    set term off feed off head off pages 0
    select table_name from user_tables;
    exit
    EOF
    ~ >./s.sh
    DEPT
    EMP
    BONUS
    SALGRADE
    SCHEME_CBFOWF1
    DR$SCHEME_CBFOWF1_IDX$I
    DR$SCHEME_CBFOWF1_IDX$R
    PROVATAB1
    DR$PROVAINDEX1$I
    DR$PROVAINDEX1$R
    CREATE$JAVA$LOB$TABLE
    X
    SYS_IOT_OVER_57950
    SYS_IOT_OVER_57953
    JAVA$OPTIONS
    PROVA1
    DR$PROVAINDEX1$N
    DR$PROVAINDEX1$K
    DR$SCHEME_CBFOWF1_IDX$N
    DR$SCHEME_CBFOWF1_IDX$KBest regards
    Maxim

  • Changing the date_format in Oracle9i

    I need to change the date format of my DB Oracle9i .I added the parameter in the initsid.ora file and created the spfile from pfile.Did an oracle shut-start.
    It shows the required format as
    SQL> sho parameter nls_date_for
    NAME                TYPE VALUE
    nls_date_format string DD-MON-YYYY
    But it still shows the old format when i login to the instance.
    SQL*Plus: Release 9.2.0.1.0 - Production on Mon Sep 8 16:32:18 2008
    Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
    Connected to:
    Oracle9i Enterprise Edition Release 9.2.0.1.0 - 64bit Production
    With the Partitioning, OLAP and Oracle Data Mining options
    JServer Release 9.2.0.1.0 - Production
    SQL> select sysdate from dual;
    SYSDATE
    +08/09/2008+
    Please anyone suggest what can be done.

    I changed the format to 'MM-DD-YYYY' also in the init file and did db shut-start as
    SQL> conn sys as sysdba
    Enter password:
    Connected.
    SQL> shutdown immediate
    Database closed.
    Database dismounted.
    ORACLE instance shut down.
    SQL>
    SQL> startup nomount pfile='/GSC/system/oracle/OraHome1/dbs/initgsc.ora'
    ORACLE instance started.
    Total System Global Area  639075872 bytes
    Fixed Size                   730656 bytes
    Variable Size             603979776 bytes
    Database Buffers           33554432 bytes
    Redo Buffers                 811008 bytes
    SQL> create spfile from pfile;
    File created.
    SQL> shutdown immediate
    ORA-01507: database not mounted
    ORACLE instance shut down.
    SQL> startup
    ORACLE instance started.
    Total System Global Area  639075872 bytes
    Fixed Size                   730656 bytes
    Variable Size             603979776 bytes
    Database Buffers           33554432 bytes
    Redo Buffers                 811008 bytes
    Database mounted.
    Database opened.
    SQL>
    SQL>
    SQL> select sysdate from dual;
    SYSDATE
    +09-09-2008+
    Seems like working fine...:) But
    when i login to instance i stilll get the old format :(
    +$ sqlplus fincub/fincub+
    SQL*Plus: Release 9.2.0.1.0 - Production on Tue Sep 9 14:51:55 2008
    Copyright (c) 1982, 2002, Oracle Corporation.  All rights reserved.
    Connected to:
    Oracle9i Enterprise Edition Release 9.2.0.1.0 - 64bit Production
    With the Partitioning, OLAP and Oracle Data Mining options
    JServer Release 9.2.0.1.0 - Production
    SQL> select sysdate from dual;
    SYSDATE
    +09/09/2008+
    Is there something else that i have to do so it works for all my users.
    thanks & regards,
    shiva

  • Format NUMBER fields in SQLPLUS

    Hi All,
    I'm trying to extract a table into a file (fixed-length fields) with SQLPLUS. The column is 'DEPTNO', defined as NUMBER(2), So I did:
    select to_char(DEPTNO, 'FM09') from table;
    But this always gave me 3-character long output. I expect it to be 2-character long. Given the definition and the fmt I used. I can't figure out why. I also tried '09' and even RTRIM and LTRIM. Didn't work.
    I had the following settings:
    set space 0
    set colsep ""
    Am i missing something here?
    I'll appreciate your help in advance.
    Thanks!
    Scott
    null

    The number formatting functions leave an extra character for a potential sign. This is an old "feature".
    If you have access to Oracle's bug database there is information and some cross references in bug 287153 you may wish to review.
    - CJ

  • SP2-0246 when COLUMN FORMAT DATE in sqlplus

    Hi,
    I've read in 'Oracle 11g SQL' Jason Price book that I can format column of DATE type in sqlplus by i.e.:
    COLUMN <name> FORMAT 'YYYY'
    but when I tried then got:
    SQL> SELECT table_name, column_name, data_type FROM user_tab_columns WHERE data_type LIKE '%DATE%';
    TABLE_NAME COLUMN_NAME
    DATA_TYPE
    CUSTOMERS DOB
    DATE
    CUSTOMERS2 DOB
    DATE
    ORDER_STATUS LAST_MODIFIED
    DATE
    SQL> COLUMN dob FORMAT YYYY
    SP2-0246: Illegal FORMAT string "YYYY"
    Well, there is mistake in the book or I'm doing sth in wrong way???
    greetings
    mac

    Welcome to the forum.
    Usually this is done through NLS_DATE_FORMAT:
    SQL> create table t as select sysdate dt from dual;
    Table created.
    SQL> desc t
    Name                                      Null?    Type
    DT                                                 DATE
    SQL> column dt format YYYY
    SP2-0246: Illegal FORMAT string "YYYY"
    SQL> column dt format "YYYY"
    SP2-0246: Illegal FORMAT string "YYYY"
    SQL>  column dt format 'yyyy'
    SP2-0246: Illegal FORMAT string "yyyy"
    SQL> select * from t;
    DT
    24-03-2013 14:08:39
    SQL> alter session set nls_date_format = 'YYYY';
    Session altered.
    SQL> select * from t;
    DT
    2013
    SQL>

  • Sqlplus set statement:format the output without specifying every col length

    Hi ppl,
    i am writing below query inside a shell script. Is there any way to format the output of sqlplus without providing the name of all the columns that we are going to output. for example, in below code i have specified the column width of the columns i want to output. but if the number of columns is large (or when we want to do a select * from...) then it becomes tedious to write all of them. Is there any way i can define display length all the columns to be of same size.. or at least all the number columns of one size, char columns of one size etc...
    sqlplus -sa/passwd@db_name << EOF
    SET ECHO ON;
    SET HEADING ON;
    COLUMN USERNAME FORMAT A20;
    COLUMN USER_ID FORMAT A20;
    COLUMN PASSWORD FORMAT A20;
    spool filename.txt
    some qry... ;
    exit
    EOFThanks
    Edited by: KnockTurnAll on 25 Oct, 2010 10:41 PM
    Edited by: KnockTurnAll on 26-Oct-2010 04:25

    My SQL*Plus is a bit rusty, but I don't think you can for characters. You can set NUMWIDTH for a default size for numeric columns.
    You could write a small bit of SQL to generate the required column definitions. You could even hit ALL_TAB_COLUMNS to generate a generic 'set every column width' file and run it as a separate sql script in your main script. Not sure if there is an upper limit on the number of Columns you can define.
    Back in the day when we did everything with SQL*Plus scripts, we had a standard columns file that we called in all our scripts, just for this purpose.
    Carl

  • Sqlplus formatting in SQLJ

    Hi,
    I am trying to run the following sqlplus formatting commands like
    set pagesize 100
    set long 40000
    it runs fine at SQL>
    but when i try to run them in sqlj like:
    #sql {set pagesize 100};
    #sql {set long 40000};
    i get the following error
    "missing or invalid option"
    anyone has any idea how do we embed sqlplus formatting commands into sqlj or jdbc ....
    cheers
    Omair

    I'm not sure you need to.
    SQL*Plus uses OCI to retrieve data from LONG columns. In order to do that, you have to fetch it in chunks and SQL*Plus defaults to fetching only a small amount. The "SET LONG..." command tells SQL*Plus how many chunks to fetch.
    In JDBC/sqlj, you fetch the long column into a java.sql.Clob or oracle.sql.Clob and then use the methods of the class to manipulate the contents of the column.

  • Formatting output of execute plan in sqlplus

    My execution plan looks ugly:
    Execution Plan
       0      SELECT STATEMENT Optimizer=ALL_ROWS (Cost=535 Card=1 Bytes=3
              46)
       1    0   SORT (ORDER BY) (Cost=535 Card=1 Bytes=346)
       2    1     NESTED LOOPS (Cost=534 Card=1 Bytes=346)
       3    2       NESTED LOOPS (Cost=516 Card=9 Bytes=2142)
       4    3         HASH JOIN (Cost=156 Card=180 Bytes=23400)
       5    4           TABLE ACCESS (BY INDEX ROWID) OF 'FND_LOOKUP_VALUE
              S' (TABLE) (Cost=4 Card=2 Bytes=116)
       6    5             INDEX (RANGE SCAN) OF 'FND_LOOKUP_VALUES_U1' (IN
              DEX (UNIQUE)) (Cost=3 Card=2)
       7    4           TABLE ACCESS (BY INDEX ROWID) OF 'PON_AUCTION_ATTR
              IBUTES' (TABLE) (Cost=151 Card=312 Bytes=22464)
       8    7             INDEX (RANGE SCAN) OF 'PON_AUCTION_ATTRIBUTES_U1
              ' (INDEX (UNIQUE)) (Cost=4 Card=624)
       9    3         TABLE ACCESS (BY INDEX ROWID) OF 'FND_NEW_MESSAGES'
              (TABLE) (Cost=2 Card=1 Bytes=108)
      10    9           INDEX (UNIQUE SCAN) OF 'FND_NEW_MESSAGES_PK' (INDE
              X (UNIQUE)) (Cost=1 Card=1)
      11    2       TABLE ACCESS (BY INDEX ROWID) OF 'FND_NEW_MESSAGES' (T
              ABLE) (Cost=2 Card=1 Bytes=108)
      12   11         INDEX (UNIQUE SCAN) OF 'FND_NEW_MESSAGES_PK' (INDEX
              (UNIQUE)) (Cost=1 Card=1)How can I format it to avoid wrapping? And is there a way to do it permanently (rather than just for one session) ?

    How can I format it to avoid wrapping?
    COLUMN plan_plus_exp FORMAT a100
    And is there a way to do it permanently (ratherthan just for one session) ?
    Please read about [url
    http://download-uk.oracle.com/docs/cd/B10501_01/server
    .920/a90842/ch3.htm#1005634]SQL*Plus Configuration:
    Site Profile in the manual.Thanks a lot.

  • Sqlplus format

    Hi Guys...
    How do I format my query to return columns in this format:
    Column Name Value
    Column 1 V1
    Column 2 V2
    Column 3 V3
    Instead of having them horizontal.
    Thanks in advance.
    Edited by: user11979518 on Oct 8, 2009 12:55 AM
    Edited by: user11979518 on Oct 8, 2009 12:59 AM
    Edited by: user11979518 on Oct 8, 2009 1:00 AM

    Hi,
    What you are looking for seems to be UNPIVOT. Something like:
    SELECT * FROM your_table
       UNPIVOT (value FOR col_name IN
                  (col1 AS 'Column 1'
                  ,col2 AS 'Column 2',
                  ,col3 AS 'Column 3')
       ORDER BY col_name;Regards
    Peter

  • Date formatting in SQLPlus

    Hello
    I am new to Oracle and need some help formatting a date string. I am on Oracle 9.2.0.1 and need to convert a date string from this format 5-22-2007 to this format 22-May-2007. Iam converting data from an MS Access tool into Oracle using Oracle Conversion tools so I need to add the formatting to a control file and import a dat file. Any help on this would be greatly appreciated.
    Sincerely
    Kim Mitchell

    I was not aware you could do that. I have control files that will take a csv and load the data into the same databse field as named in the control file. The difficulty lies in the fact that I actually have to legacy systems, an IBM iseries database and an Access DB, some data will come from both systems. However they both have ODBC connections/drivers so it may work. If there is an easier way I am all ears or eyes in this case.
    Can you explain more about this or do tyou have a good resource I could look at?
    Thanks
    Kim

  • Sqlplus not honoring formating in 10g

    I have several reports that a script runs every night at midnight. We have just recently migrated from 8i (8.1.7) to 10gR2 (10.2.0.1). I have not made any changes to the select statement or formating. During testing the report came out in the same format. After we went live, the format comes out differently.
    it is not taking formating statements like substr(field,1,30). Here is the statment and the 8i and 10g output. Any suggestions? is there an oracle parameter set wrong?
    bj
    query/report:
    set heading on;
    set linesize 150;
    set pagesize 100;
    spool /u01/app/oracle/Epay.dat;
    select auction_id,substr(buyer,1,20) buyer,authonly_request_date,
    substr(authonly_status,1,21) Authonly_status,bcs_request_date,
    substr(bcs_status_name,1,21) BCS_STATUS,date_settled
    from (
    SELECT A.FEP_AUTHONLY_ID,A.AUCTION_ID,A.BUYER,A.AUCTION_NAME,A.authonly_request_date,
    a.authonly_status,a.authonly_message,a.merchant_name,b.fep_bcs_id,b.bcs_request_date,b.amount,
    b.code,b.bcs_message,b.bcs_status_name,b.bid_total_price,b.salesagent,b.date_settled
    FROM
    (select fa.fep_authonly_id,fa.auction_id,c.cust_first_name||' '||c.cust_last_name buyer,
    substr(a.auction_name,1,30) auction_name,fad.request_date authonly_request_date,
    fm.fep_merchant_id,fm.vendor_id,fm.name merchant_name,
    fts.status_name authonly_status,fts.display authonly_display,fa.message authonly_message--,fa.fep_batch_id
    from fep_authonly fa, fep_merchant fm, fep_trans_status fts, auction2 a, customer c, auction_end_state aes,
    (select auction_id,max(request_date) request_date from fep_authonly group by auction_id) fad
    where fa.fep_merchant_id = fm.fep_merchant_id
    and fa.fep_trans_status_id = fts.fep_trans_status_id
    and fa.auction_id=a.auction_id
    and a.auction_id = aes.auction_id
    and aes.auction_state_cd in ('ACCEPTED','COMPLETE')
    and a.owner_id=c.customer_id
    and c.agency_id not in (10270,10274)
    and fa.auction_id=fad.auction_id
    and fa.request_date=fad.request_date
    --group by fa.request_date
    order by fa.fep_authonly_id
    ) a,
    (select fbcs.fep_bcs_id,a.auction_id,fbcs.fep_batch_id,fbcs.request_date bcs_request_date,fbcs.amount,
    fbcs.code,fbcs.message bcs_message,fts.status_name bcs_status_name,b.bid_total_price,
    sa.first_name||' '||sa.last_name salesagent,fm.vendor_id,fm.name,fb.date_settled
    from fep_bcs fbcs,fep_merchant fm, bid2 b,fep_trans_status fts, salesagent sa,auction2 a,fep_batch fb
    where fbcs.fep_merchant_id=fm.fep_merchant_id
    and fbcs.fep_trans_status_id = fts.fep_trans_status_id
    and fbcs.bid_id=b.bid_id
    and b.owner_id=sa.salesagent_id
    and b.bid_id = a.bid_vendor_selected
    and fbcs.fep_batch_id = fb.fep_batch_id(+)
    order by fbcs.fep_bcs_id
    ) b
    where a.auction_id = b.auction_id(+)
    where date_settled IS NULL
    or date_settled >= sysdate-10
    order by authonly_request_date desc
    spool off;
    8i output:
    AUC_ID BUYER AUTHONLY_ AUTHONLY_STATUS BCS_REQUE BCS_STATUS DATE_SETT
    28697 Michelle Gilman 07-JUL-06 TRANS_STATUS_APPROVED
    28790 Renee Nixon 05-JUL-06 TRANS_STATUS_APPROVED 07-JUL-06 TRANS_STATUS_APPROVED 08-JUL-06
    28740 Renee Nixon 05-JUL-06 TRANS_STATUS_APPROVED
    28735 Renee Nixon 30-JUN-06 TRANS_STATUS_APPROVED 10-JUL-06 TRANS_STATUS_APPROVED 11-JUL-06
    28479 Michelle Gilman 26-JUN-06 TRANS_STATUS_APPROVED
    27735 Margrethe Ravnholt-H 01-JUN-06 TRANS_STATUS_APPROVED
    27388 Renee Nixon 19-MAY-06 TRANS_STATUS_APPROVED
    26688 Renee Nixon 01-MAY-06 TRANS_STATUS_APPROVED
    26650 Terri Smith 01-MAY-06 TRANS_STATUS_APPROVED
    25234 Renee Nixon 07-MAR-06 TRANS_STATUS_APPROVED 06-JUL-06 TRANS_STATUS_APPROVED 07-JUL-06
    10g output
    AUCTION_ID BUYER
    AUTHONLY_ AUTHONLY_STATUS BCS_REQUE BCS_STATUS
    29127 Saratou Yahouza
    24-JUL-06 TRANS_STATUS_APPROVED
    29425 Renee Nixon
    21-JUL-06 TRANS_STATUS_APPROVED
    28697 Michelle Gilman
    07-JUL-06 TRANS_STATUS_APPROVED
    28740 Renee Nixon
    05-JUL-06 TRANS_STATUS_APPROVED
    28479 Michelle Gilman
    26-JUN-06 TRANS_STATUS_APPROVED
    27735 Margrethe Ravnholt-H
    01-JUN-06 TRANS_STATUS_APPROVED
    27388 Renee Nixon
    19-MAY-06 TRANS_STATUS_APPROVED 18-JUL-06 TRANS_STATUS_TIMEOUT
    26688 Renee Nixon
    01-MAY-06 TRANS_STATUS_APPROVED 24-JUL-06 TRANS_STATUS_APPROVED
    26650 Terri Smith
    01-MAY-06 TRANS_STATUS_APPROVED
    9 rows selected.

    as a fix, you could use
    col buyer for a20

  • Output format of sqlplus commands under shell script

    hi experts
    Can you help with some problems please?
    1.) I try to run shell script from dbms_scheduler, which runs sqlplus and the output of sqlplus commands is written to file using command spool. To this point everything is running ok.
    My problem is, that output of this file is: (e.g.)
    SQL> PROMPT ****************USERB******************
    ****************USERB******************
    SQL> --SELECT sid
    SQL> -- FROM v
    SQL> -- WHERE audsid = SYS_CONTEXT('userenv','sessionid');
    But I don't want the whole first line in the output file. I only want the output of this command, like on the second line.
    2.) How Can I write two outputs from sqlplus using command spool running at the same time into one file?
    Like in first issue described above. The main sqlplus create a job and this execute the background sqlplus using shell script. But both, the main and the background sqlplus are written to output file at the same time. But only one is written into. But I want the both outputs in the file.
    How Can I do that, if I can?
    Thanks a lot.

    user9357436 wrote:
    hi experts
    Can you help with some problems please?
    1.) I try to run shell script from dbms_scheduler, which runs sqlplus and the output of sqlplus commands is written to file using command spool. To this point everything is running ok. then why are you here?
    My problem is, that output of this file is: (e.g.)
    SQL> PROMPT ****************USERB******************
    ****************USERB******************so remove PROMPT line from the file
    >
    SQL> --SELECT sid
    SQL> -- FROM v
    SQL> -- WHERE audsid = SYS_CONTEXT('userenv','sessionid');
    But I don't want the whole first line in the output file. I only want the output of this command, like on the second line.
    2.) How Can I write two outputs from sqlplus using command spool running at the same time into one file?you can not do so.
    Like in first issue described above. The main sqlplus create a job and this execute the background sqlplus using shell script. But both, the main and the background sqlplus are written to output file at the same time. But only one is written into. But I want the both outputs in the file.
    How Can I do that, if I can?Can't.
    Now what?
    >
    Thanks a lot.Why using DBMS_SCHEDULER to invoke OS script to run sqlplus that runs SQL statements?
    this is like making THREE Left Turns, instead of single Right Turn.
    Just invoke PL/SQL procedure that does what needs to be done.

  • SQLplus: formatting problem.

    Hello, good people.
    I've just started using Oracle and SQLplus, and because I haven't set up the environment properly, it's very hard to interpret the output.
    http://imageshack.us/f/199/sqlpluserror.png
    As one can see from the picture, the underline goes out too far, and the output does not cover the entire width of the screen. Because of that, the output is spread out over too many lines, and it's quite difficuelt to read the results.

    881905 wrote:
    Hello, good people.
    I've just started using Oracle and SQLplus, and because I haven't set up the environment properly, it's very hard to interpret the output.
    http://imageshack.us/f/199/sqlpluserror.png
    As one can see from the picture, the underline goes out too far, and the output does not cover the entire width of the screen. Because of that, the output is spread out over too many lines, and it's quite difficuelt to read the results.It is really, Really, REALLY difficult to fix a problem that can not be seen.
    use COPY & PASTE so we can see what you do & how Oracle responds.

  • SQLPlus formatting

    I can't tell what is causing this, but when I execute SQL scripts in SQLPLUS, I get many numbers in the middle of the SQL. Something like:
    select
    where upper(table1.C 46   47   48   49   50   51   52   53   54   55   56   57   58   59   60   61   62   63   64   65   66 ble2.col2                > P_item
    and col4 = :P_NUM1; 67   68   69   70   71   72   73   74   75   76   77   78   79   80   81   82   83   84
    How do I get rid of the numbers in between?
    Thanks!

    Here is what I execute:
    VARIABLE
    COMP_VERSION1  
    NUMBER;
    VARIABLE
    COMP_VERSION2  
    NUMBER;
    VARIABLE
    COMP_VERSION3  
    NUMBER;
    VARIABLE
    COMP_VERSION4  
    NUMBER;
    VARIABLE
    COMP_VERSION5  
    NUMBER;
    VARIABLE
    COMP_VERSION6  
    NUMBER;
    VARIABLE
    COMP_VERSION7  
    NUMBER;
    VARIABLE
    COMP_VERSION8  
    NUMBER;
    VARIABLE
    COMP_VERSION9  
    NUMBER;
    VARIABLE
    COMP_VERSION10 
    NUMBER;
    VARIABLE
    COMP_VERSION11 
    NUMBER;
    VARIABLE
    COMP_VERSION12 
    NUMBER;
    VARIABLE
    COMP_VERSION13 NUMBER;
    VARIABLE
    COMP_VERSION14 
    NUMBER;
    VARIABLE
    COMP_VERSION15 
    NUMBER;
    VARIABLE
    COMP_VERSION16 
    NUMBER;
    VARIABLE
    COMP_VERSION17 
    NUMBER;
    VARIABLE
    COMP_VERSION18 
    NUMBER;
    VARIABLE
    COMP_VERSION19 
    NUMBER;
    VARIABLE
    COMP_VERSION20 
    NUMBER;
    VARIABLE
    COMP_VERSION21 
    NUMBER;
    VARIABLE
    COMP_VERSION22 
    NUMBER;
    VARIABLE
    COMP_VERSION23 
    NUMBER;
    VARIABLE
    COMP_VERSION24 
    NUMBER;
    VARIABLE
    COMP_VERSION25 
    NUMBER;
    VARIABLE
    COMP_VERSION26 
    NUMBER;
    VARIABLE
    COMP_VERSION27 
    NUMBER;
    VARIABLE
    COMP_VERSION28 
    NUMBER;
    VARIABLE
    COMP_VERSION29 
    NUMBER;
    VARIABLE
    COMP_VERSION30 
    NUMBER;
    VARIABLE
    COMP_VERSION31 
    NUMBER;
    VARIABLE
    COMP_VERSION32 
    NUMBER;
    VARIABLE
    COMP_VERSION33 
    NUMBER;
    VARIABLE
    COMP_VERSION34 
    NUMBER;
    VARIABLE
    COMP_VERSION35 
    NUMBER;
    VARIABLE
    COMP_VERSION36 
    NUMBER;
    VARIABLE
    COMP_VERSION37 
    NUMBER;
    VARIABLE
    COMP_VERSION38 
    NUMBER;
    VARIABLE
    COMP_VERSION39 
    NUMBER;
    VARIABLE
    COMP_VERSION40 
    NUMBER;
    VARIABLE
    COMP_VERSION41 
    NUMBER;
    VARIABLE
    COMP_VERSION42 
    NUMBER;
    VARIABLE
    COMP_VERSION43 
    NUMBER;
    VARIABLE
    COMP_VERSION44 
    NUMBER;
    VARIABLE
    COMP_VERSION45 
    NUMBER;
    VARIABLE
    COMP_VERSION46 
    NUMBER;
    VARIABLE
    COMP_VERSION47 
    NUMBER;
    VARIABLE
    COMP_VERSION48 
    NUMBER;
    VARIABLE
    COMP_VERSION49 
    NUMBER;
    VARIABLE
    COMP_VERSION50 
    NUMBER;
    VARIABLE P_ACTV_FLG VARCHAR2(1);
    VARIABLE P_MDL_YR
    NUMBER;
    VARIABLE P_DIVISION_ID   NUMBER;
    VARIABLE P_MODEL
    VARCHAR2(100);
    VARIABLE P_TRIM
    VARCHAR2(100);
    VARIABLE P_STYLE_NM_WO_TRIM  VARCHAR2(100);
    VARIABLE P_VEH_COMP_SRC_CD1 
    VARCHAR2(100);
    VARIABLE P_VEH_COMP_SRC_CD2 
    VARCHAR2(100);
    VARIABLE P_VEH_COMP_SRC_CD3 
    VARCHAR2(100);
    VARIABLE P_VEH_COMP_SRC_CD4 
    VARCHAR2(100);
    VARIABLE P_SOLD_PRICE
    NUMBER;
    VARIABLE P_TAKE_PRICE NUMBER;
    VARIABLE P_ASK_PRICE  NUMBER;
    VARIABLE P_VS_BODY_TYPE_CD1  VARCHAR2(100);
    VARIABLE P_VS_BODY_TYPE_CD2  VARCHAR2(100);
    VARIABLE P_VS_BODY_TYPE_CD3  VARCHAR2(100);
    VARIABLE P_MARKET_PRICE_FLG
    VARCHAR2(100);
    VARIABLE P_VEH_ODOM
    NUMBER;
    VARIABLE P_VEH_COMP_AGE_BASE
    VARCHAR2(100);
    VARIABLE P_VEH_COMP_LONGITUDE1 NUMBER;
    VARIABLE P_VEH_COMP_LONGITUDE2 NUMBER;
    VARIABLE P_VEH_COMP_LATITUDE1 NUMBER;
    VARIABLE P_VEH_COMP_LATITUDE2 NUMBER;
    VARIABLE SDO_GEOMETRY1 NUMBER;
    VARIABLE SDO_GEOMETRY2 NUMBER;
    VARIABLE SDO_POINT_TYPE1 NUMBER;
    VARIABLE SDO_POINT_TYPE2 NUMBER;
    VARIABLE SDO_POINT_TYPE3 NUMBER;
    VARIABLE SDO_POINT_UNIT VARCHAR2(100);
    VARIABLE SDO_POINT_DISTANCE NUMBER;
    EXEC
    :COMP_VERSION1  
    :=  1216;
    EXEC
    :COMP_VERSION2  
    :=  1219;
    EXEC
    :COMP_VERSION3  
    :=  1359;
    EXEC
    :COMP_VERSION4  
    :=  1356;
    EXEC
    :COMP_VERSION5  
    :=  1487;
    EXEC
    :COMP_VERSION6  
    :=  1487;
    EXEC
    :COMP_VERSION7  
    :=  1245;
    EXEC
    :COMP_VERSION8  
    :=  1240;
    EXEC
    :COMP_VERSION9  
    :=  1242;
    EXEC
    :COMP_VERSION10 
    :=  1255;
    EXEC
    :COMP_VERSION11 
    :=  1132;
    EXEC
    :COMP_VERSION12 
    :=  1252;
    EXEC
    :COMP_VERSION13 
    :=  1249;
    EXEC
    :COMP_VERSION14 
    :=  1263;
    EXEC
    :COMP_VERSION15 
    :=  1261;
    EXEC
    :COMP_VERSION16 
    :=  1258;
    EXEC
    :COMP_VERSION17 
    :=  1270;
    EXEC
    :COMP_VERSION18 
    :=  1151;
    EXEC
    :COMP_VERSION19 
    :=  1267;
    EXEC
    :COMP_VERSION20 
    :=  1146;
    EXEC
    :COMP_VERSION21 
    :=  1265;
    EXEC
    :COMP_VERSION22 
    :=  1426;
    EXEC
    :COMP_VERSION23 
    :=  1153;
    EXEC
    :COMP_VERSION24 
    :=  1306;
    EXEC
    :COMP_VERSION25 
    :=  1155;
    EXEC
    :COMP_VERSION26 
    :=  1309;
    EXEC
    :COMP_VERSION27 
    :=  1433;
    EXEC
    :COMP_VERSION28 
    :=  1436;
    EXEC
    :COMP_VERSION29 
    :=  1291;
    EXEC
    :COMP_VERSION30 
    :=  1289;
    EXEC
    :COMP_VERSION31 
    :=  1282;
    EXEC
    :COMP_VERSION32 
    :=  1280;
    EXEC
    :COMP_VERSION33 
    :=  1287;
    EXEC
    :COMP_VERSION34 
    :=  1181;
    EXEC
    :COMP_VERSION35 
    :=  1182;
    EXEC
    :COMP_VERSION36 
    :=  1285;
    EXEC
    :COMP_VERSION37 
    :=  1190;
    EXEC
    :COMP_VERSION38 
    :=  1466;
    EXEC
    :COMP_VERSION39 
    :=  1331;
    EXEC
    :COMP_VERSION40 
    :=  1333;
    EXEC
    :COMP_VERSION41 
    :=  1198;
    EXEC
    :COMP_VERSION42 
    :=  1335;
    EXEC
    :COMP_VERSION43 
    :=  1196;
    EXEC
    :COMP_VERSION44 
    :=  1203;
    EXEC
    :COMP_VERSION45 
    :=  1200;
    EXEC
    :COMP_VERSION46 
    :=  1206;
    EXEC
    :COMP_VERSION47 
    :=  1204;
    EXEC
    :COMP_VERSION48 
    :=  1446;
    EXEC
    :COMP_VERSION49 
    :=  1327;
    EXEC
    :COMP_VERSION50 
    :=  1214;
    EXEC :P_ACTV_FLG := 'Y';
    EXEC :P_MDL_YR
    := 2012;
    EXEC :P_DIVISION_ID   := 17;
    EXEC :P_MODEL
    := 'SONATA';
    EXEC :P_TRIM
    := 'GLS';
    EXEC :P_STYLE_NM_WO_TRIM  := '4DR SDN 2.4L MAN';
    EXEC :P_VEH_COMP_SRC_CD1
    := 'CAD';
    EXEC :P_VEH_COMP_SRC_CD2 
    := 'FIR';
    EXEC :P_VEH_COMP_SRC_CD3 
    := 'CAD';
    EXEC :P_VEH_COMP_SRC_CD4 
    := 'FIR';
    EXEC :P_SOLD_PRICE
    := 0;
    EXEC :P_TAKE_PRICE := 0;
    EXEC :P_ASK_PRICE  := 0;
    EXEC :P_VS_BODY_TYPE_CD1  := 'CNV';
    EXEC :P_VS_BODY_TYPE_CD2  := 'WGN';
    EXEC :P_VS_BODY_TYPE_CD3  := 'OTH';
    EXEC :P_MARKET_PRICE_FLG
    := 'L';
    EXEC :P_VEH_ODOM
    := 0;
    EXEC :P_VEH_COMP_AGE_BASE
    := '18-Jun-2013';
    EXEC :P_VEH_COMP_LONGITUDE1 := 78.65692553753594;
    EXEC :P_VEH_COMP_LONGITUDE1 := 84.41847446246406;
    EXEC :P_VEH_COMP_LATITUDE1 := 38.92925712882992;
    EXEC :P_VEH_COMP_LATITUDE2 := 43.27094287117008;
    EXEC :SDO_GEOMETRY1 := 2001;
    EXEC :SDO_GEOMETRY2 := 8307;
    EXEC :SDO_POINT_TYPE1 := 81.5377;
    EXEC :SDO_POINT_TYPE2 := 41.1001;
    EXEC :SDO_POINT_TYPE3 := 1;
    EXEC :SDO_POINT_UNIT := 'unit=MILE';
    EXEC :SDO_POINT_DISTANCE := 500;
    SELECT comparable0_.VERSION_ID           
    AS VERSION1_92_0_,
      comparable0_.DL_COMPARABLE_ID          
    AS DL2_92_0_,
      vehicleent1_.DL_VEH_ID                 
    AS DL1_131_1_,
      comparable0_.APPL_ID                   
    AS APPL3_92_0_,
      comparable0_.LOCK_ID                   
    AS LOCK4_92_0_,
      comparable0_.MODIFID_DT                
    AS MODIFID5_92_0_,
      comparable0_.REC_DT                    
    AS REC6_92_0_,
      comparable0_.USER_ID                   
    AS USER7_92_0_,
      comparable0_.ACTV_FLG                  
    AS ACTV8_92_0_,
      comparable0_.ADV_PHONE                 
    AS ADV9_92_0_,
      comparable0_.ADV_PHONE1                
    AS ADV10_92_0_,
      comparable0_.ADV_PHONE_EXT             
    AS ADV11_92_0_,
      comparable0_.ADV_PHONE1_EXT            
    AS ADV12_92_0_,
      comparable0_.ASK_PRICE                 
    AS ASK13_92_0_,
      comparable0_.CCC_REGION                
    AS CCC14_92_0_,
      comparable0_.CITY                      
    AS CITY92_0_,
      comparable0_.CONTACT_PERSON_NM         
    AS CONTACT16_92_0_,
      comparable0_.COUNTRY_CD                
    AS COUNTRY17_92_0_,
      comparable0_.DEALER_NM                 
    AS DEALER18_92_0_,
      comparable0_.DSTOCK_NUM                
    AS DSTOCK19_92_0_,
      comparable0_.FLG_STOCK_PLATE           
    AS FLG20_92_0_,
      comparable0_.INSPECTED_DT              
    AS INSPECTED21_92_0_,
      comparable0_.MARKET_PRICE              
    AS MARKET22_92_0_,
      comparable0_.MARKET_PRICE_FLG          
    AS MARKET23_92_0_,
      comparable0_.MERGED_FROM_VEH_ID        
    AS MERGED24_92_0_,
      comparable0_.MERGED_FROM_VEH_VERSION   
    AS MERGED25_92_0_,
      comparable0_.NADA_REGION               
    AS NADA26_92_0_,
      comparable0_.NOTE_EXTERNAL             
    AS NOTE27_92_0_,
      comparable0_.NOTE_INTERNAL             
    AS NOTE28_92_0_,
      comparable0_.PSTL_CD                   
    AS PSTL29_92_0_,
      comparable0_.SOLD_PRICE                
    AS SOLD30_92_0_,
      comparable0_.ST_CD                     
    AS ST31_92_0_,
      comparable0_.TAKE_PRICE                
    AS TAKE32_92_0_,
      comparable0_.VEH_COMP_AGE_BASE         
    AS VEH33_92_0_,
      comparable0_.VEH_COMP_LATITUDE         
    AS VEH34_92_0_,
      comparable0_.VEH_COMP_LONGITUDE        
    AS VEH35_92_0_,
      comparable0_.VEH_COMP_SRC_CD           
    AS VEH36_92_0_,
      comparable0_.VEH_COMP_SRC_TYP          
    AS VEH37_92_0_,
      comparable0_.VEH_COMP_STATUS_CD        
    AS VEH38_92_0_,
      comparable0_.VEH_COMP_VERIFD_CD        
    AS VEH39_92_0_,
      comparable0_.VEH_SRC_ID                
    AS VEH40_92_0_,
      comparable0_.DL_VEH_ID                 
    AS DL41_92_0_,
      vehicleent1_.APPL_ID                   
    AS APPL2_131_1_,
      vehicleent1_.LOCK_ID                   
    AS LOCK3_131_1_,
      vehicleent1_.MODIFID_DT                
    AS MODIFID4_131_1_,
      vehicleent1_.REC_DT                    
    AS REC5_131_1_,
      vehicleent1_.USER_ID                   
    AS USER6_131_1_,
      vehicleent1_.VS_BODY_TYPE_CD           
    AS VS7_131_1_,
      vehicleent1_.VEH_COND_CD               
    AS VEH8_131_1_,
      vehicleent1_.DIVISION_ID               
    AS DIVISION9_131_1_,
      vehicleent1_.ENGINE_ASP                
    AS ENGINE10_131_1_,
      vehicleent1_.ENGINE_CARB               
    AS ENGINE11_131_1_,
      vehicleent1_.ENGINE_CYL                
    AS ENGINE12_131_1_,
      vehicleent1_.ENGINE_DISP               
    AS ENGINE13_131_1_,
      vehicleent1_.ENGINE_FUEL               
    AS ENGINE14_131_1_,
      vehicleent1_.EXTR_COLOR                
    AS EXTR15_131_1_,
      vehicleent1_.MAKE_DESC                 
    AS MAKE16_131_1_,
      vehicleent1_.MODEL                     
    AS MODEL131_1_,
      vehicleent1_.MDL_YR                    
    AS MDL19_131_1_,
      vehicleent1_.NUM_DOORS                 
    AS NUM20_131_1_,
      vehicleent1_.VEH_ODOM                  
    AS VEH21_131_1_,
      vehicleent1_.STYLE_ENGINE_VARIANT_ID   
    AS STYLE22_131_1_,
      vehicleent1_.STYLE_ID                  
    AS STYLE23_131_1_,
      vehicleent1_.STYLE_NM_WO_TRIM          
    AS STYLE24_131_1_,
      vehicleent1_.STYLE_VERSION_ID          
    AS STYLE25_131_1_,
      vehicleent1_.TRIM                      
    AS TRIM131_1_,
      vehicleent1_.VS_VEH_TYPE_CD            
    AS VS27_131_1_,
      vehicleent1_.VIN                       
    AS VIN131_1_,
      vehicleent1_.VIN_DCD_UI_MSG            
    AS VIN29_131_1_
    FROM VS_COMPARABLE_DATA comparable0_
    INNER JOIN VS_VEHICLE VEHICLEENT1_
    ON COMPARABLE0_.DL_VEH_ID          
    =VEHICLEENT1_.DL_VEH_ID
    WHERE (comparable0_.VERSION_ID    
    IN (:COMP_VERSION1 ,:COMP_VERSION2, :COMP_VERSION3, :COMP_VERSION4 ,:COMP_VERSION5 ,
    :COMP_VERSION6 ,:COMP_VERSION7 ,:COMP_VERSION8 ,:COMP_VERSION9 ,:COMP_VERSION10,:COMP_VERSION11,:COMP_VERSION12,
    :COMP_VERSION13,:COMP_VERSION14,:COMP_VERSION15,:COMP_VERSION16,:COMP_VERSION17,:COMP_VERSION18,:COMP_VERSION19,
    :COMP_VERSION20,:COMP_VERSION21,:COMP_VERSION22,:COMP_VERSION23,:COMP_VERSION24,:COMP_VERSION25,:COMP_VERSION26,
    :COMP_VERSION27,:COMP_VERSION28,:COMP_VERSION29,:COMP_VERSION30,:COMP_VERSION31,:COMP_VERSION32,:COMP_VERSION33,
    :COMP_VERSION34,:COMP_VERSION35,:COMP_VERSION36,:COMP_VERSION37,:COMP_VERSION38,:COMP_VERSION39,:COMP_VERSION40,
    :COMP_VERSION41,:COMP_VERSION42,:COMP_VERSION43,:COMP_VERSION44,:COMP_VERSION45,:COMP_VERSION46,:COMP_VERSION47,
    :COMP_VERSION48,:COMP_VERSION49,:COMP_VERSION50 ))
    AND COMPARABLE0_.ACTV_FLG          
    =:P_ACTV_FLG
    AND vehicleent1_.MDL_YR            
    =:P_MDL_YR
    AND vehicleent1_.DIVISION_ID       
    =:P_DIVISION_ID
    AND upper(vehicleent1_.MODEL)      
    =:P_MODEL
    AND upper(vehicleent1_.TRIM)       
    =:P_TRIM
    AND upper(vehicleent1_.STYLE_NM_WO_TRIM) =:P_STYLE_NM_WO_TRIM
    AND (comparable0_.VEH_COMP_SRC_CD  
    =:P_VEH_COMP_SRC_CD1
    AND comparable0_.SOLD_PRICE        
    >:P_SOLD_PRICE
    OR comparable0_.VEH_COMP_SRC_CD    
    =:P_VEH_COMP_SRC_CD2
    AND (comparable0_.SOLD_PRICE       
    >:P_SOLD_PRICE
    OR comparable0_.TAKE_PRICE         
    >:P_TAKE_PRICE)
    OR comparable0_.VEH_COMP_SRC_CD   
    <>:P_VEH_COMP_SRC_CD3
    AND comparable0_.VEH_COMP_SRC_CD  
    <>:P_VEH_COMP_SRC_CD4
    AND (comparable0_.SOLD_PRICE       
    >:P_SOLD_PRICE
    OR comparable0_.TAKE_PRICE         
    >:P_TAKE_PRICE
    OR comparable0_.ASK_PRICE          
    >:P_ASK_PRICE))
    AND (vehicleent1_.VS_BODY_TYPE_CD NOT  IN (:P_VS_BODY_TYPE_CD1, :P_VS_BODY_TYPE_CD2 , :P_VS_BODY_TYPE_CD3))
    AND (comparable0_.MARKET_PRICE_FLG
    IS NULL
    OR comparable0_.MARKET_PRICE_FLG  
    <>:P_MARKET_PRICE_FLG
    OR comparable0_.SOLD_PRICE         
    >:P_SOLD_PRICE
    OR comparable0_.TAKE_PRICE         
    >comparable0_.MARKET_PRICE
    OR comparable0_.MARKET_PRICE       
    >comparable0_.ASK_PRICE)
    AND vehicleent1_.VEH_ODOM          
    >:P_VEH_ODOM
    AND comparable0_.VEH_COMP_AGE_BASE
    >=:P_VEH_COMP_AGE_BASE
    AND (comparable0_.VEH_COMP_LONGITUDE BETWEEN :P_VEH_COMP_LONGITUDE1 AND :P_VEH_COMP_LONGITUDE2)
    AND (COMPARABLE0_.VEH_COMP_LATITUDE BETWEEN :P_VEH_COMP_LATITUDE1 AND :P_VEH_COMP_LATITUDE2)
    AND SDO_GEOM.SDO_DISTANCE(MDSYS.SDO_GEOMETRY(:SDO_GEOMETRY1, :SDO_GEOMETRY2,
    MDSYS.SDO_POINT_TYPE(comparable0_.VEH_COMP_LONGITUDE, comparable0_.VEH_COMP_LATITUDE, NULL), NULL, NULL),
    MDSYS.SDO_GEOMETRY(:SDO_GEOMETRY1, :SDO_GEOMETRY2, MDSYS.SDO_POINT_TYPE(:SDO_POINT_TYPE1, :SDO_POINT_TYPE2, NULL), NULL, NULL),
    :SDO_POINT_TYPE3, :SDO_POINT_UNIT)<:SDO_POINT_DISTANCE;
    Here is what I get:
    PL/SQL procedure successfully completed.
    SQL>
    PL/SQL procedure successfully completed.
    SQL>
    PL/SQL procedure successfully completed.
    SQL>
    PL/SQL procedure successfully completed.
    SQL>
    PL/SQL procedure successfully completed.
    SQL>
    PL/SQL procedure successfully completed.
    SQL>
    PL/SQL procedure successfully completed.
    SQL>
    PL/SQL procedure successfully completed.
    SQL>
    PL/SQL procedure successfully completed.
    SQL>
    PL/SQL procedure successfully completed.
    SQL>
    PL/SQL procedure successfully completed.
    SQL>
    PL/SQL procedure successfully completed.
    SQL>
    PL/SQL procedure successfully completed.
    SQL>
    PL/SQL procedure successfully completed.
    SQL>
    PL/SQL procedure successfully completed.
    SQL>
    PL/SQL procedure successfully completed.
    SQL>
    PL/SQL procedure successfully completed.
    SQL>
    PL/SQL procedure successfully completed.
    SQL>
    PL/SQL procedure successfully completed.
    SQL>
    PL/SQL procedure successfully completed.
    SQL>
    PL/SQL procedure successfully completed.
    SQL>
    PL/SQL procedure successfully completed.
    SQL>
    PL/SQL procedure successfully completed.
    SQL>
    PL/SQL procedure successfully completed.
    SQL>
    PL/SQL procedure successfully completed.
    SQL> EXEC :P_TAKE_PRICE := 0
    EXEC :P_ASK_PRICE  := 0
    EXEC :P_VS_BODY_TYPE_CD1  := 'CNV'
    EXEC :P_VS_BODY_TYPE_CD2  := 'WGN'
    EXEC :P_VS_BODY_TYPE_CD3  := 'OTH'
    EXEC :P_MARKET_PRICE_FLG    := 'L'
    EXEC :P_VEH_ODOM    := 0
    EXEC :P_VEH_COMP_AGE_BASE    := '18-Jun-2013'
    EXEC :P_VEH_COMP_LONGITUDE1 := 78.65692553753594
    EXEC :P_VEH_COMP_LONGITUDE1 := 84.41847446246406
    EXEC :P_VEH_COMP_LATITUDE1 := 38.92925712882992
    EXEC :P_VEH_COMP_LATITUDE2 := 43.27094287117008
    EXEC :SDO_GEOMETRY1 := 2001
    EXEC :SDO_GEOMETRY2 := 8307
    EXEC :SDO_POINT_TYPE1 := 81.5377
    EXEC :SDO_POINT_TYPE2 := 41.1001
    EXEC :SDO_POINT_TYPE3 := 1
    EXEC :SDO_POINT_UNIT := 'unit=MILE'
    EXEC :SDO_POINT_DISTANCE := 500
    SELECT comparable0_.VERSION_ID                AS VERSION1_92_0_,
      comparable0_.DL_COMPARABLE_ID               AS DL2_92_0_,
      vehicleent1_.DL_VEH_ID                      AS DL1_131_1_,
      comparable0_.APPL_ID                        AS APPL3_92_0_,
      comparable0_.LOCK_ID                        AS LOCK4_92_0_,
      comparable0_.MODIFID_DT                     AS MODIFID5_92_0_,
      comparable0_.REC_DT                         AS REC6_92_0_,
      comparable0_.USER_ID                        AS USER7_92_0_,
      comparable0_
    PL/SQL procedure successfully completed.
    SQL>
    PL/SQL procedure successfully completed.
    SQL>
    PL/SQL procedure successfully completed.
    SQL>
    PL/SQL procedure successfully completed.
    SQL>
    PL/SQL procedure successfully completed.
    SQL>
    PL/SQL procedure successfully completed.
    SQL>
    PL/SQL procedure successfully completed.
    SQL>
    PL/SQL procedure successfully completed.
    SQL>
    PL/SQL procedure successfully completed.
    SQL>
    PL/SQL procedure successfully completed.
    SQL>
    PL/SQL procedure successfully completed.
    SQL>
    PL/SQL procedure successfully completed.
    SQL>
    PL/SQL procedure successfully completed.
    SQL>
    PL/SQL procedure successfully completed.
    SQL>
    PL/SQL procedure successfully completed.
    SQL>
    PL/SQL procedure successfully completed.
    SQL>
    PL/SQL procedure successfully completed.
    SQL>
    PL/SQL procedure successfully completed.
    SQL>
    PL/SQL procedure successfully completed.
    SQL>
    PL/SQL procedure successfully completed.
    SQL>
    PL/SQL procedure successfully completed.
    SQL>
    PL/SQL procedure successfully completed.
    SQL>
    PL/SQL procedure successfully completed.
    SQL>
    PL/SQL procedure successfully completed.
    SQL>   2    3    4    5               AS CONTACT16_92_0_,
      comparable0_.COUNTRY_CD                     AS COUNTRY17_92_0_,
      comparable0_.DEALER_NM                      AS DEALER18_92_0_,
      comparable0_.DSTOCK_NUM                     AS DSTOCK19_92_0_,
      comparable0_.FLG_STOCK_PLATE                AS FLG20_92_0_,
      comparable0_.INSPECTED_DT                   AS INSPECTED21_92_0_,
      comparable0_.MARKET_PRICE                   AS MARKET22_92_0_,
      comparable0_.MARKET_PRICE_FLG               AS MARKET23_92_0_,
      comparable0_.MERGED_FROM_VEH_ID             AS MERGED24_92_0_,
      comparable0_.MERGED_FROM_VEH_VERSION        AS MERGED25_92_0_,
      comparable0_.NADA_REGION                    AS NADA26_92_0_,
      comparable0_.NOTE_EXTERNAL                  AS NOTE27_92_0_,
      comparable0_.NOTE_INTERNAL                  AS NOTE28_92_0_,
      comparable0_.PSTL_CD                        AS PSTL29_92_0_,
      comparable0_.SOLD_PRICE                     AS SOLD30_92_0_,
      comparable0_.ST_CD                          AS ST31_92_0_,
      comparable0_.TAKE_PRICE                     AS TAKE32_92_0_,
      comparable0_.VEH_COMP_AGE_BASE              AS VEH33_92_0_,
      comparable0_.VEH_COMP_LATITUDE              AS VEH34_92_0_,
      comparable0_.VEH_COMP_LONGITUDE             AS VEH35_92_0_,
      comparable0_.VEH_COMP_SRC_CD                AS VEH36_92_0_,
      comparable0_.VEH_COMP_SRC_TYP               AS VEH37_92_0_,
      comparable0_.VEH_COMP_STATUS_CD             AS VEH38_92_0_,
      comparable0_.VEH_COMP_VERIFD_CD             AS VEH39_92_0_,
      comparable0_.VEH_SRC_ID                     AS VEH40_92_0_,
      comparable0_.DL_VEH_ID                      AS DL41_92_0_,
      vehicleent1_.APPL_ID                        AS APPL2_131_1_,
      vehicleent1_.LOCK_ID                        AS LOCK3_131_1_,
      vehicleent1_.MODIFID_DT                     AS MODIFID4_131_1_,
      vehicleent1_.REC_DT                         AS REC5_131_1_,
      vehicleent1_.USER_ID                        AS USER6_131_1_,
      vehicleent1_.VS_BODY_TYPE_CD                AS VS7_131_1_,
      vehicleent1_.VEH_COND_CD                    AS VEH8_131_1_,
      vehicleent1_.DIVISION_ID                    AS DIVISION9_131_1_,
      vehicleent1_.ENGINE_ASP                     AS ENGINE10_131_1_,
      vehicleent1_.ENGINE_CARB                    AS ENGINE11_131_1_,
      vehicleent1_.ENGINE_CYL                     AS ENGINE12_131_1_,
      vehicleent1_.ENGINE_DISP                    AS ENGINE13_131_1_,
      vehicleent1_.ENGINE_FUEL                    AS ENGINE14_131_1_,
      vehicleent1_.EXTR_COLOR                     AS EXTR15_131_1_,
      vehicleent1_.MAKE_DESC                      6    7    8    9   10   11   12   13   14   15   16   17   18   19   20   21   22   23   24   25   26   27   28   29   30   31   32   33   34   35   36   37   38   39   40   41   42   43   44   45  AS STYLE25_131_1_,
      vehicleent1_.TRIM                           AS TRIM131_1_,
      vehicleent1_.VS_VEH_TYPE_CD                 AS VS27_131_1_,
      vehicleent1_.VIN                            AS VIN131_1_,
      vehicleent1_.VIN_DCD_UI_MSG                 AS VIN29_131_1_
    FROM VS_COMPARABLE_DATA comparable0_
    INNER JOIN VS_VEHICLE VEHICLEENT1_
    ON COMPARABLE0_.DL_VEH_ID               =VEHICLEENT1_.DL_VEH_ID
    WHERE (comparable0_.VERSION_ID         IN (:COMP_VERSION1 ,:COMP_VERSION2, :COMP_VERSION3, :COMP_VERSION4 ,:COMP_VERSION5 ,
    :COMP_VERSION6 ,:COMP_VERSION7 ,:COMP_VERSION8 ,:COMP_VERSION9 ,:COMP_VERSION10,:COMP_VERSION11,:COMP_VERSION12,
    :COMP_VERSION13,:COMP_VERSION14,:COMP_VERSION15,:COMP_VERSION16,:COMP_VERSION17,:COMP_VERSION18,:COMP_VERSION19,
    :COMP_VERSION20,:COMP_VERSION21,:COMP_VERSION22,:COMP_VERSION23,:COMP_VERSION24,:COMP_VERSION25,:COMP_VERSION26,
    :COMP_VERSION27,:COMP_VERSION28,:COMP_VERSION29,:COMP_VERSION30,:COMP_VERSION31,:COMP_VERSION32,:COMP_VERSION33,
    :COMP_VERSION34,:COMP_VERSION35,:COMP_VERSION36,:COMP_VERSION37,:COMP_VERSION38,:COMP_VERSION39,:COMP_VERSION40,
    :COMP_VERSION41,:COMP_VERSION42,:COMP_VERSION43,:COMP_VERSION44,:COMP_VERSION45,:COMP_VERSION46,:COMP_VERSION47,
    :COMP_VERSION48,:COMP_VERSION49,:COMP_VERSION50 ))
    AND COMPARABLE0_.ACTV_FLG               =:P_ACTV_FLG
    AND vehicleent1_.MDL_YR                 =:P_MDL_YR
    AND vehicleent1_.DIVISION_ID            =:P_DIVISION_ID
    AND upper(vehicleent1_.MODEL)           =:P_MODEL
    AND upper(vehicleent1_.TRIM)            =:P_TRIM
    AND upper(vehicleent1_.S 46   47   48   49   50   51   52   53   54   55   56   57   58   59   60   61   62   63   64   65   66  able0_.TAKE_PRICE              >:P_TAKE_PRICE
    OR comparable0_.ASK_PRICE               >:P_ASK_PRICE))
    AND (vehicleent1_.VS_BODY_TYPE_CD NOT  IN (:P_VS_BODY_TYPE_CD1, :P_VS_BODY_TYPE_CD2 , :P_VS_BODY_TYPE_CD3))
    AND (comparable0_.MARKET_PRICE_FLG     IS NULL
    OR comparable0_.MARKET_PRICE_FLG       <>:P_MARKET_PRICE_FLG
    OR comparable0_.SOLD_PRICE              >:P_SOLD_PRICE
    OR comparable0_.TAKE_PRICE              >comparable0_.MARKET_PRICE
    OR comparable0_.MARKET_PRICE            >comparable0_.ASK_PRICE)
    AND vehicleent1_.VEH_ODOM               >:P_VEH_ODOM
    AND comparable0_.VEH_COMP_AGE_BASE     >=:P_VEH_COMP_AGE_BASE
    AND (comparable0_.VEH_COMP_LONGITUDE BETWEEN :P_VEH_COMP_LONGITUDE1 AND :P_VEH_COMP_LONGITUDE2)
    AND (COMPARABLE0_.VEH_COMP_LATITUDE BETWEEN :P_VEH_COMP_LATITUDE1 AND :P_VEH_COMP_LATITUDE2)
    AND SDO_GEOM.SDO_DISTANCE(MDSYS.SDO_GEOMETRY(:SDO_GEOMETRY1, :SDO_GEOMETRY2,
    MDSYS.SDO_POINT_TYPE(comparable0_.VEH_COMP_LONGITUDE, comparable0_.VEH_COMP_LATITUDE, NULL), NULL, NULL),
    MDSYS.SDO_GEOMETRY(:SDO_GEOMETRY1, :SDO_GEOMETRY2, MDSYS.SDO_POINT_TYPE(:SDO_POINT_TYPE1, :SDO_POINT_TYPE2, NULL), NULL, NULL),
    :SDO_POINT_TYPE3, :SDO_POINT_UNIT)<:SDO_POINT_DISTANCE; 67   68   69   70   71   72   73   74   75   76   77   78   79   80   81   82   83   84   85

Maybe you are looking for