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

Similar Messages

  • 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.

  • 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

  • 11g Client - Inconsistencies at the 16th decimal place

    In TOAD, SQLPlus, & ODBC clients numbers returned from a query are correct (max 3 decimal places)
    In Discoverer & from a report, the numbers are off at the 16th decimal place...
    EG:
    7.081 becomes 7.0810000000000004
    7.090 becomes 7.0999999999999994 (which is exceptionally weird because the rounding doesn't work)
    7.200 becomes 7.2000000000000002
    Any idea what would cause this?
    How can I query from SQLPlus (or TOAD) to confirm whether or not those extended decimal places actually exist in the table?

    Alan3 wrote:
    Maybe I should have added this little tidbit...Please be as verbose as possible (feasible). Show queries etc. - use copy and paste.
    The particular table in question is an interface table that has been in place for 4+ years.
    The columns in question are of data type NUMBER.
    We just switched the PC that runs this interface to Win7 with an 11g client.Describe the interface. E.g. In what program language is it written?
    Now we see the extended decimals with Discoverer (on any PC) and the interface report (an old report built from developer 6) as well, but not from SQL, etc...How is changing one pc client related to the Discoverer and Reports reports? Has the database server been upgraded also? (full version from select * from v$version; )
    Do you see the same change for "old" data (from before the switch).
    I want to know if there is a setting in SQLPlus or the DB client that limits the display of the decimal places that I can alter to determine if the extended decimals actually show up... (they shouldn't be there at all)Both sqlplus and db may affect the outcome, e.g.
    SQL> desc test
    Name                                      Null?    Type
    A                                                  NUMBER
    B                                                  NUMBER(38,5)
    SQL> show numw
    numwidth 10
    SQL>
    SQL> select * from test;
             A          B
         12345      12345
    123456789  123456789
        123,45     123,45
    123,456789  123,45679
         1,234      1,234
    1,23456789    1,23457
    6 rows selected.The same values was inserted to both columns of test. With scale = 5 for its datatype, B values are rounded (4th and 6th row).
    SQL> set numw 5
    SQL> select * from test;
        A     B
    12345 12345
    123,5 123,5
    123,5 123,5
    1,234 1,234
    1,235 1,235
    6 rows selected.The numwidth setting affects sqlplus formatting.
    Edited by: orafad on Jan 5, 2011 9:44 PM

  • Where to read about is-thread-safe tag?

    Hello,
    Does anybody know what tag <is-thread-safe> means and if it mandatory in ias-ejb-jar.xml runtime deployment descriptor. I've found it for helloworld sample for iAS 6.0 SP3 but it is not mentioned in AppServer Programmer's Guide for iAS 6.0 SP2 - the only last guide available on this subject for today.
    Thank you,
    Andrejus

    The SQL plus reference guide immediately springs to mind, as I can see that you are using sqlplus for your output.
    Actually, you don't need any sqlplus formatting. Gicven that you should know that an oracle table_name is never more than 30 characters, just rpad it to 30.
    declare
    cursor c1 is select owner, table_name
    from dba_tables
    where owner = 'SYSTEM'
    group by owner, table_name;
    sql_stmnt varchar2(4000);
    cnt_val number;
    begin
    for c1_rec in c1 loop
    sql_stmnt := 'select count(*) from '||c1_rec.owner||'.'||c1_rec.table_name;
    execute immediate sql_stmnt into cnt_val;
    dbms_output.put_line(rpad(C1_REC.TABLE_NAME,30)||' '||cnt_val||' rows');
    end loop;
    end;Message was edited by:
    Keith Jamieson

  • Database Migration:Resolving DB links issue.

    Hi,
    We are to migrate one of our production database to a new server. The DB version is 11.2.0.3 and it is on AIX 6.1. There will be no change in version of DB or OS.
    In our setup there are some number of other Oracle databases which connects to this database using DB links. We do not use DNS so, DB links are completely dependent on IP address. In this case the IP of the database server will change due to migration.
    My Question, Is there any way I can determine which databases connects to this database using DB links? We need to resolve those db links post migration.
    Looking for kind help. Thanks.
    -Gourab

    940748 wrote:
    Thanks for reply.
    What I tried is to query dba_audit_trail and found a distinct list of USERHOST. These contains clients as PC/Application Servers/Other Database servers. This narrow down my search though, I can not confirm this list is 100%. DBA_AUDIT_TRAIL has a retention and there may be an application that runs twice a year.
    --Gourab
    Well, consider this.  Your connecting clients fall into three groups:
    1) End-user desktops
    2) Application servers
    3) other databases using db links.
    Hopefully, group 2 is already well known.
    Group requires a bit of research, but is actually pretty easy to collect on an ad-hoc basis.
    Create two sql script files.
    -- sweep_db.sql --
    spool sweep_db.log
    connect system/manager@db_1
    @query_db_links.sql
    connect system/manager@db_2
    @query_db_links.sql
    -- etc, etc
    spool off
    exit
    and
    -- query_db_links.sql
    select * from dba_db_links.
    exit
    You will need to know the names and connection credentials of all possible 'client' databases in order to build 'sweep_db.sql'.  And it will take a manual reading of sweep_db.log, but for a one-time effort that's not all that bad.
    You may want to add some sqlplus formatting commands to sweep_db.sql

  • Create a file in a local PC.

    Dear Sirs:
    I am tried to create one stored procedure so that when it is invoked believes in the local PC a Single file txt. I have found the form to create using it utl_file and only in the server later to use an instruction of FTP to transfer it to a PC. Exists some method that allows me to create directly, a file of type text or any other type, in a PC without having to store it in the server and soon to send it to the PC by means of FTP?
    I thank you for its aid beforehand.

    I would not do it this way, looping around and formatting the output in pl/sql, that is best left to the client.
    In this example the procedure passes back a cursor with the results, and sqlplus formats them and outputs them.
    Note there are a couple of commands print c and spool off that appear in the output file as I exeuted it interactively for demo purposes.
    When scripted with set termout off added you won't get those.
    If you are running the procedure from a different client, like forms the method to write to the client would be different.
    SQL> select * from emp;
    EMPNO ENAME      JOB          MGR HIREDATE      SAL   COMM DEPTNO
      7369 SMITH      CLERK       7902 12-17-1980    800            20
      7499 ALLEN      SALESMAN    7698 02-20-1981   1600    300     30
      7521 WARD       SALESMAN    7698 02-22-1981   1250    500     30
      7566 JONES      MANAGER     7839 04-02-1981   2975            20
      7654 MARTIN     SALESMAN    7698 09-28-1981   1250   1400     30
      7698 BLAKE      MANAGER     7839 05-01-1981   2850            30
      7782 CLARK      MANAGER     7839 06-09-1981   2450            10
      7788 SCOTT      ANALYST     7566 12-09-1982   3000            20
      7839 KING       PRESIDENT        11-17-1981   5000            10
      7844 TURNER     SALESMAN    7698 09-08-1981   1500      0     30
      7876 ADAMS      CLERK       7788 01-12-1983   1100            20
      7900 JAMES      CLERK       7698 12-03-1981    950            30
      7902 FORD       ANALYST     7566 12-03-1981   3000            20
      7934 MILLER     CLERK       7782 01-23-1982   1300            10
    14 rows selected.
    SQL> create or replace procedure p (
      2    p_deptno in emp.deptno%type,
      3    p_rc out sys_refcursor
      4    )
      5  as
      6  begin
      7    open p_rc for
      8      select * from emp where deptno = p_deptno;
      9  end;
    10  /
    Procedure created.
    SQL> alter session set nls_date_format = 'dd/mm/yyyy';
    Session altered.
    SQL> col sal format 999,999
    SQL> col comm format 999,999
    SQL> set feedback off
    SQL> set pagesize 0
    SQL> var c refcursor
    SQL> exec p(30, :c)
    SQL> spool out.txt
    SQL> print c
      7499 ALLEN      SALESMAN    7698 20/02/1981    1,600      300     30
      7521 WARD       SALESMAN    7698 22/02/1981    1,250      500     30
      7654 MARTIN     SALESMAN    7698 28/09/1981    1,250    1,400     30
      7698 BLAKE      MANAGER     7839 01/05/1981    2,850              30
      7844 TURNER     SALESMAN    7698 08/09/1981    1,500        0     30
      7900 JAMES      CLERK       7698 03/12/1981      950              30
    SQL> spool off
    SQL> host type out.txt
    SQL> print c
      7499 ALLEN      SALESMAN    7698 20/02/1981    1,600      300     30
      7521 WARD       SALESMAN    7698 22/02/1981    1,250      500     30
      7654 MARTIN     SALESMAN    7698 28/09/1981    1,250    1,400     30
      7698 BLAKE      MANAGER     7839 01/05/1981    2,850              30
      7844 TURNER     SALESMAN    7698 08/09/1981    1,500        0     30
      7900 JAMES      CLERK       7698 03/12/1981      950              30
    SQL> spool off
    SQL>

  • To display all rows and columns in proper alignment

    My Question is when I want to display multiple recoreds the rows are splits many time and displaying recoreds are combersome to understand, so please give me the solution about this problem.
    when this query is executed, single row comes in multiple rows after this question below some line of displays rows are shown.
    Thanks!
    SELECT
         E.Empno EmpNo,
         E.Ename EmpName,
         E.Job EmpJob,
         E.HireDate EmpHireDate,
         E.Deptno Empdeptno,
         NVL((TO_CHAR( E.Comm )),'No Comm') EmpComm,
         E.Sal EmpSal,
         E.Sal+NVL(E.Comm,0) EmpTotalSal,
         (TO_CHAR(SYSDATE,'YYYY')-TO_CHAR(E.HireDate,'YYYY')) EmpExpInYear,
         E.deptno EmpDeptno,
         ED.Dname EmpDname,
         ED.Loc EmpDeptLoc,
         ES.Grade EmpSalGrade,
              NVL((TO_CHAR(M.Empno)),'supereme') Mgrno,
              NVL((TO_CHAR(M.Ename)),'s auth') MgrName,
              NVL((TO_CHAR(M.HireDate)),'Not Assign') MgrHireDate,
              NVL((TO_CHAR(M.Sal)),'NOt assign') MgrSal,
              NVL((TO_CHAR(M.Comm)),'Not applicable') MgrComm,
              NVL((TO_CHAR(M.Sal+NVL(M.Comm,0))),'Not Assign') MgrTotalSal,
              NVL((TO_CHAR( E.HireDate - M.HireDate)),'Mgr Not Assign') Seniorindays,
              NVL((TO_CHAR((TO_CHAR(SYSDate,'YYYY')-TO_CHAR(M.HireDate,'YYYY'))- (TO_CHAR(SYSDATE,'YYYY')-TO_CHAR(E.HireDate,'YYYY')))),'No mgr Assign') MgrSeniority ,
              NVL((TO_CHAR(TO_CHAR(SYSDATE,'YYYY')-TO_CHAR(M.HireDate,'YYYY'))),'No Mgr Available') MgrExpInYear,
              NVL((TO_CHAR(E.Sal-M.sal)),'Not Assign') EmpAndMgrSalDiff,
              NVL((TO_CHAR(M.Deptno)),'not assign') Mgrdeptno,
              NVL((TO_CHAR(MD.Dname)),'sup does not have mgr') MgrDeptName,
              NVL((TO_CHAR(MD.Loc)),'Sup does not have mgr') MgrDeptLoc,
              NVL((TO_CHAR(MS.Grade)),'Sup does not have mgr') MgrSalGrade
                        FROM
                        Emp E, Emp M, Dept ED, Dept MD, SalGrade MS, SalGrade ES
                        WHERE M.Empno(+) = E.Mgr AND E.Deptno = ED.Deptno(+) AND
                        M.Deptno = MD.Deptno(+) AND
                        M.Sal BETWEEN MS.Losal(+) AND MS.HiSal(+) AND
                        E.Sal BETWEEN ES.Losal(+) AND ES.HiSal(+)
    EMPNO EMPNAME EMPJOB EMPHIREDA EMPDEPTNO EMPCOMM EMPSAL EMPTOTALSAL EMPEXPINYEAR EMPDEPTNO EMPDNAME EMPDEPTLOC EMPSALGRADE
    MGRNO MGRNAME MGRHIREDAT MGRSAL MGRCOMM MGRTOTALSAL
    MGRSENIORITY MGREXPINYEAR EMPANDMGRSALDIFF MGRDEPTNO MGRDEPTNAME
    MGRDEPTLOC MGRSALGRADE
    7839 KING PRESIDENT 17-NOV-81 10 No Comm 5000 5000 28 10 ACCOUNTING NEW YORK 5
    supereme s auth Not Assign NOt assign Not applicable Not Assign
    No mgr Assign No Mgr Available Not Assign not assign sup does not have mgr
    Sup does not have mgr Sup does not have mgr
    EMPNO EMPNAME EMPJOB EMPHIREDA EMPDEPTNO EMPCOMM EMPSAL EMPTOTALSAL EMPEXPINYEAR EMPDEPTNO EMPDNAME EMPDEPTLOC EMPSALGRADE
    MGRNO MGRNAME MGRHIREDAT MGRSAL MGRCOMM MGRTOTALSAL
    MGRSENIORITY MGREXPINYEAR EMPANDMGRSALDIFF MGRDEPTNO MGRDEPTNAME
    MGRDEPTLOC MGRSALGRADE
    7788 SCOTT ANALYST 19-APR-87 20 No Comm 3000 3000 22 20 RESEARCH DALLAS 4
    7566 JONES 02-APR-81 2975 Not applicable 2975
    6 28 25 20 RESEARCH
    DALLAS 4
    Edited by: user12252618 on 9 Dec, 2009 11:07 AM

    user12252618 wrote:
    My Question is when I want to display multiple recoreds the rows are splits many time and displaying recoreds are combersome to understand, so please give me the solution about this problem.
    when this query is executed, single row comes in multiple rows after this question below some line of displays rows are shown.
    Thanks!
    <snip>
    This is a simple line wrap problem. Are you doing this in sqlplus? if so
    set linesize 256
    set trimspool onAnd while you are looking up those commands in the SQLPlus Reference (you will look the up to study the details, right?) you might take a look at some of the other sqlplus formatting commands as well.
    Edited by: EdStevens on Dec 9, 2009 1:25 PM

  • 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;

  • 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

  • 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

  • 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

Maybe you are looking for

  • How can I move my songs from an XP PC to a NAS?

    Hi there. I had an old XP machine, that was holding all my MP3 songs, no DRM. Over the network, my whole family had access, everybody was using his own iTunes for his iPod. So everybody had his own "C:\Users\XXX\Music\iTunes\iTunes Media" database. W

  • Problem with syncing palm

    When I open isync, there is a yellow triangle over the palm icon and an error message stating that syncing may not work. However, syncing does work. I want to change a setting in the isync pane but that error message wont let me do anything. thanks K

  • HT3777 Leopard 10.6.8  with Boot Camp 3 do not support Windows XP SP2???

    Hello! I have my MacBook Pro with Leopard 10.6.8 with Boot Camp 3 on it.Reading a BOOT CAM article I could see that it supports Windows XP SP2.I just installed Windows XP SP2...and when I am trying to use the drivers from MAC DVD it says that BOOT CA

  • Inbound emails from internet stuck in smtp database queue

    I have 4 exchange servers 2 MBX and 2 CAS. I am forwarding the smtp request from firewall to cas02 and using cas01 as stand by. Email are working fine except some time when we look at the email queue emails get queued n smtp database. And it take ver

  • Survey suite URL

    Hi Forum, I have an issue with survey suite, I have created and generated the survey questionnaire and the original url is also generated and it is opening on WAS also. Now I would like to know how do I send it to the customer in case I send it by ma