ORA-06550: Please-00103, ORA-06550: Please-00103 DECODE function

Hi to all.
I have client oracle 8i and i'm using pl sql developer.
I have the following plsql procedure:
set serveroutput on size 1000000;
DECLARE
type t_cur is ref cursor;
type type_rec is record (codicepool char(12),
codicefisico char(12),
givenname varchar2(12),
denominazione char(40),
tipoedificio varchar2(50),
tipoimpianto varchar2(40),
stationtypecaminus char(40),
codiceateco varchar2(8),
capacitatrasporto number(9),
capacitaconferita1 number(9), capacitaconferita2 number(9),capacitaconferita3 number(9),capacitaconferita4 number(9),
capacitaconferita5 number (9),capacitaconferita6 number(9),capacitaconferita7 number(9),capacitaconferita8 number(9),
capacitaconferita9 number (9),capacitaconferita10 number(9),capacitaconferita11 number(9),capacitaconferita12 number(9),
capacitaconferita13 number(9),capacitaconferita14 number(9),capacitaconferita15 number(9),capacitaconferita16 number(9),
capacitaconferita17 number(9),capacitaconferita18 number(9),capacitaconferita19 number(9),capacitaconferita20 number(9),
capacitaconferita21 number(9),capacitaconferita22 number(9),capacitaconferita23 number(9),capacitaconferita24 number(9),
capacitaconferita25 number(9),capacitaconferita26 number(9),capacitaconferita27 number(9),capacitaconferita28 number(9),
capacitaconferita29 number(9),capacitaconferita30 number(9),capacitaconferita31 number(9),
energia1 number(9),energia2 number(9),energia3 number(9),energia4 number(9),energia5 number(9),energia6 number(9),energia7 number(9),
energia8 number(9),energia9 number(9),energia10 number(9),energia11 number(9),energia12 number(9),energia13 number(9),energia14 number(9),
energia15 number(9),energia16 number(9),energia17 number(9),energia18 number(9),energia19 number(9),energia20 number(9),energia21 number(9),
energia22 number(9),energia23 number(9),energia24 number(9),energia25 number(9),energia26 number(9),energia27 number(9),energia28 number(9),
energia29 number(9),energia30 number(9),energia31 number(9),
volumeprofilato1 number(9),volumeprofilato2 number(9),volumeprofilato3 number(9),volumeprofilato4 number(9),volumeprofilato5 number(9),
volumeprofilato6 number(9),volumeprofilato7 number(9),volumeprofilato8 number(9),volumeprofilato9 number(9),
volumeprofilato10 number(9),
volumeprofilato11 number(9),volumeprofilato12 number(9),volumeprofilato13 number(9),volumeprofilato14 number(9),volumeprofilato15 number(9),
volumeprofilato16 number(9),volumeprofilato17 number(9),volumeprofilato18 number(9),volumeprofilato19 number(9),volumeprofilato20 number(9),
volumeprofilato21 number(9),volumeprofilato22 number(9),volumeprofilato23 number(9),volumeprofilato24 number(9),volumeprofilato25 number(9),
volumeprofilato26 number(9),volumeprofilato27 number(9),volumeprofilato28 number(9),volumeprofilato29 number(9),volumeprofilato30 number(9),
volumeprofilato31 number(9),tipo_misura char(20));
cur t_cur;
bilancio_rec type_rec;
f utl_file.file_type;
begin
f := utl_file.fopen('SAMPLEDATA','prova_bilancio.txt','W');
OPEN cur for
SELECT q.codicepool, q.codicefisico, q.denominazione, q.tipoedificio,
q.tipoimpianto, q.stationtypecaminus, q.codiceateco,
q.capacitatrasporto, c.cc1 AS capacitaconferita1,
c.cc2 AS capacitaconferita2, c.cc3 AS capacitaconferita3,
c.cc4 AS capacitaconferita4, c.cc5 AS capacitaconferita5,
c.cc6 AS capacitaconferita6, c.cc7 AS capacitaconferita7,
c.cc8 AS capacitaconferita8, c.cc9 AS capacitaconferita9,
c.cc10 AS capacitaconferita10, c.cc11 AS capacitaconferita11,
c.cc12 AS capacitaconferita12, c.cc13 AS capacitaconferita13,
c.cc14 AS capacitaconferita14, c.cc15 AS capacitaconferita15,
c.cc16 AS capacitaconferita16, c.cc17 AS capacitaconferita17,
c.cc18 AS capacitaconferita18, c.cc19 AS capacitaconferita19,
c.cc20 AS capacitaconferita20, c.cc21 AS capacitaconferita21,
c.cc22 AS capacitaconferita22, c.cc23 AS capacitaconferita23,
c.cc24 AS capacitaconferita24, c.cc25 AS capacitaconferita25,
c.cc26 AS capacitaconferita26, c.cc27 AS capacitaconferita27,
c.cc28 AS capacitaconferita28, c.cc29 AS capacitaconferita29,
c.cc30 AS capacitaconferita30, c.cc31 AS capacitaconferita31,
v.dk1 / 10 AS energia1, v.dk2 / 10 AS energia2, v.dk3 / 10 AS energia3,
v.dk4 / 10 AS energia4, v.dk5 / 10 AS energia5, v.dk6 / 10 AS energia6,
v.dk7 / 10 AS energia7, v.dk8 / 10 AS energia8, v.dk9 / 10 AS energia9,
v.dk10 / 10 AS energia10, v.dk11 / 10 AS energia11,
v.dk12 / 10 AS energia12, v.dk13 / 10 AS energia13,
v.dk14 / 10 AS energia14, v.dk15 / 10 AS energia15,
v.dk16 / 10 AS energia16, v.dk17 / 10 AS energia17,
v.dk18 / 10 AS energia18, v.dk19 / 10 AS energia19,
v.dk20 / 10 AS energia20, v.dk21 / 10 AS energia21,
v.dk22 / 10 AS energia22, v.dk23 / 10 AS energia23,
v.dk24 / 10 AS energia24, v.dk25 / 10 AS energia25,
v.dk26 / 10 AS energia26, v.dk27 / 10 AS energia27,
v.dk28 / 10 AS energia28, v.dk29 / 10 AS energia29,
v.dk30 / 10 AS energia30, v.dk31 / 10 AS energia31,
v.vol1 AS volumeprofilato1, v.vol2 AS volumeprofilato2,
v.vol3 AS volumeprofilato3, v.vol4 AS volumeprofilato4,
v.vol5 AS volumeprofilato5, v.vol6 AS volumeprofilato6,
v.vol7 AS volumeprofilato7, v.vol8 AS volumeprofilato8,
v.vol9 AS volumeprofilato9, v.vol10 AS volumeprofilato10,
v.vol11 AS volumeprofilato11, v.vol12 AS volumeprofilato12,
v.vol13 AS volumeprofilato13, v.vol14 AS volumeprofilato14,
v.vol15 AS volumeprofilato15, v.vol16 AS volumeprofilato16,
v.vol17 AS volumeprofilato17, v.vol18 AS volumeprofilato18,
v.vol19 AS volumeprofilato19, v.vol20 AS volumeprofilato20,
v.vol21 AS volumeprofilato21, v.vol22 AS volumeprofilato22,
v.vol23 AS volumeprofilato23, v.vol24 AS volumeprofilato24,
v.vol25 AS volumeprofilato25, v.vol26 AS volumeprofilato26,
v.vol27 AS volumeprofilato27, v.vol28 AS volumeprofilato28,
v.vol29 AS volumeprofilato29, v.vol30 AS volumeprofilato30,
v.vol31 AS volumeprofilato31, q.tipo_misura
FROM volume v,
+(SELECT ss.pipeline AS pipeline, ss.prodyear AS prodyear,+
ss.prodmonth AS prodmonth, ss.groupid AS codicepool,
+/****LINE 98 IS THIS***/ ss.meter AS codicefisico, ss.description AS denominazione,+
DECODE (sra.tipoedificio,
NULL, NULL,
+/****LINE 101 IS THIS***/ (SELECT descrizione+
FROM sap_tipi_edificio
WHERE tipoedificio = sra.tipoedificio)
+/****LINE 104 IS THIS***/ ) AS tipoedificio,+
DECODE (sra.tipoimpianto,
NULL, NULL,
+/****LINE 107 IS THIS***/ (SELECT descrizione+
FROM sap_tipi_impianto
WHERE tipoimpianto = sra.tipoimpianto)
+) AS tipoimpianto,+
st.description AS stationtypecaminus,
sra.tranpzona AS codiceateco,
ss.maxvolume AS capacitatrasporto,
DECODE (ss.stationtype,
+'ED', 'MG',+
+'EN', 'NMG',+
+'Non pervenuto'+
+) AS tipo_misura+
--SS.stationtype as tipo_misura+
FROM station_storico ss, sap_remiattributi sra, stationtype st
WHERE ss.prodyear = 2008
AND ss.prodmonth = 2
AND ( ss.prodyear = sra.prodyear()+
AND ss.prodmonth = sra.prodmonth()+
AND ss.pipeline = RPAD (sra.pipeline(), 12)+
AND ss.meter = RPAD (sra.remi(), 12)+
+) --Other Join tra Station Storico e Sap_remiattributi+
AND (st.stationtype = ss.stationtype
+) -- join tra Station_storico e stationtype+
+) q,+
+(+
--AAAAA+
+(SELECT pipeline, prodyear, prodmonth, delmeter AS meter,+
SUM (dk1) AS cc1, SUM (dk2) AS cc2, SUM (dk3) AS cc3,
SUM (dk4) AS cc4, SUM (dk5) AS cc5, SUM (dk6) AS cc6,
SUM (dk7) AS cc7, SUM (dk8) AS cc8, SUM (dk9) AS cc9,
SUM (dk10) AS cc10, SUM (dk11) AS cc11, SUM (dk12) AS cc12,
SUM (dk13) AS cc13, SUM (dk14) AS cc14, SUM (dk15) AS cc15,
SUM (dk16) AS cc16, SUM (dk17) AS cc17, SUM (dk18) AS cc18,
SUM (dk19) AS cc19, SUM (dk20) AS cc20, SUM (dk21) AS cc21,
SUM (dk22) AS cc22, SUM (dk23) AS cc23, SUM (dk24) AS cc24,
SUM (dk25) AS cc25, SUM (dk26) AS cc26, SUM (dk27) AS cc27,
SUM (dk28) AS cc28, SUM (dk29) AS cc29, SUM (dk30) AS cc30,
SUM (dk31) AS cc31
FROM statcont
WHERE prodyear = 2008
AND prodmonth = 2
AND pipeline IN
+((RPAD ('RN', 12)),+
+(RPAD ('RR=A', 12)),+
+(RPAD ('RR=B', 12)),+
+(RPAD ('RR=C', 12))+
+)+
GROUP BY pipeline, prodyear, prodmonth, delmeter
UNION
SELECT pipeline, prodyear, prodmonth, recmeter AS meter,
SUM (dk1) AS cc1, SUM (dk2) AS cc2, SUM (dk3) AS cc3,
SUM (dk4) AS cc4, SUM (dk5) AS cc5, SUM (dk6) AS cc6,
SUM (dk7) AS cc7, SUM (dk8) AS cc8, SUM (dk9) AS cc9,
SUM (dk10) AS cc10, SUM (dk11) AS cc11, SUM (dk12) AS cc12,
SUM (dk13) AS cc13, SUM (dk14) AS cc14, SUM (dk15) AS cc15,
SUM (dk16) AS cc16, SUM (dk17) AS cc17, SUM (dk18) AS cc18,
SUM (dk19) AS cc19, SUM (dk20) AS cc20, SUM (dk21) AS cc21,
SUM (dk22) AS cc22, SUM (dk23) AS cc23, SUM (dk24) AS cc24,
SUM (dk25) AS cc25, SUM (dk26) AS cc26, SUM (dk27) AS cc27,
SUM (dk28) AS cc28, SUM (dk29) AS cc29, SUM (dk30) AS cc30,
SUM (dk31) AS cc31
FROM statcont
WHERE prodyear = 2008
AND prodmonth = 2
AND pipeline IN
+((RPAD ('RN', 12)),+
+(RPAD ('RR=A', 12)),+
+(RPAD ('RR=B', 12)),+
+(RPAD ('RR=C', 12))+
+)+
GROUP BY pipeline, prodyear, prodmonth, recmeter)
UNION
+(SELECT pipeline, prodyear, prodmonth, delmeter AS meter,+
SUM (dk1) AS cc1, SUM (dk2) AS cc2, SUM (dk3) AS cc3,
SUM (dk4) AS cc4, SUM (dk5) AS cc5, SUM (dk6) AS cc6,
SUM (dk7) AS cc7, SUM (dk8) AS cc8, SUM (dk9) AS cc9,
SUM (dk10) AS cc10, SUM (dk11) AS cc11, SUM (dk12) AS cc12,
SUM (dk13) AS cc13, SUM (dk14) AS cc14, SUM (dk15) AS cc15,
SUM (dk16) AS cc16, SUM (dk17) AS cc17, SUM (dk18) AS cc18,
SUM (dk19) AS cc19, SUM (dk20) AS cc20, SUM (dk21) AS cc21,
SUM (dk22) AS cc22, SUM (dk23) AS cc23, SUM (dk24) AS cc24,
SUM (dk25) AS cc25, SUM (dk26) AS cc26, SUM (dk27) AS cc27,
SUM (dk28) AS cc28, SUM (dk29) AS cc29, SUM (dk30) AS cc30,
SUM (dk31) AS cc31
FROM statcont
WHERE prodyear = 2008
AND prodmonth = 2
AND pipeline IN
+((RPAD ('RR=D', 12)),+
+(RPAD ('RR=E1', 12)),+
+(RPAD ('RR=E2', 12)),+
+(RPAD ('RR=F', 12)),+
+(RPAD ('RR=G', 12)),+
+(RPAD ('RR=H', 12))+
+)+
GROUP BY pipeline, prodyear, prodmonth, delmeter
UNION
SELECT pipeline, prodyear, prodmonth, recmeter AS meter,
SUM (dk1) AS cc1, SUM (dk2) AS cc2, SUM (dk3) AS cc3,
SUM (dk4) AS cc4, SUM (dk5) AS cc5, SUM (dk6) AS cc6,
SUM (dk7) AS cc7, SUM (dk8) AS cc8, SUM (dk9) AS cc9,
SUM (dk10) AS cc10, SUM (dk11) AS cc11, SUM (dk12) AS cc12,
SUM (dk13) AS cc13, SUM (dk14) AS cc14, SUM (dk15) AS cc15,
SUM (dk16) AS cc16, SUM (dk17) AS cc17, SUM (dk18) AS cc18,
SUM (dk19) AS cc19, SUM (dk20) AS cc20, SUM (dk21) AS cc21,
SUM (dk22) AS cc22, SUM (dk23) AS cc23, SUM (dk24) AS cc24,
SUM (dk25) AS cc25, SUM (dk26) AS cc26, SUM (dk27) AS cc27,
SUM (dk28) AS cc28, SUM (dk29) AS cc29, SUM (dk30) AS cc30,
SUM (dk31) AS cc31
FROM statcont
WHERE prodyear = 2008
AND prodmonth = 2
AND pipeline IN
+((RPAD ('RR=D', 12)),+
+(RPAD ('RR=E1', 12)),+
+(RPAD ('RR=E2', 12)),+
+(RPAD ('RR=F', 12)),+
+(RPAD ('RR=G', 12)),+
+(RPAD ('RR=H', 12))+
+)+
GROUP BY pipeline, prodyear, prodmonth, recmeter)
UNION
+(SELECT pipeline, prodyear, prodmonth, delmeter AS meter,+
SUM (dk1) AS cc1, SUM (dk2) AS cc2, SUM (dk3) AS cc3,
SUM (dk4) AS cc4, SUM (dk5) AS cc5, SUM (dk6) AS cc6,
SUM (dk7) AS cc7, SUM (dk8) AS cc8, SUM (dk9) AS cc9,
SUM (dk10) AS cc10, SUM (dk11) AS cc11, SUM (dk12) AS cc12,
SUM (dk13) AS cc13, SUM (dk14) AS cc14, SUM (dk15) AS cc15,
SUM (dk16) AS cc16, SUM (dk17) AS cc17, SUM (dk18) AS cc18,
SUM (dk19) AS cc19, SUM (dk20) AS cc20, SUM (dk21) AS cc21,
SUM (dk22) AS cc22, SUM (dk23) AS cc23, SUM (dk24) AS cc24,
SUM (dk25) AS cc25, SUM (dk26) AS cc26, SUM (dk27) AS cc27,
SUM (dk28) AS cc28, SUM (dk29) AS cc29, SUM (dk30) AS cc30,
SUM (dk31) AS cc31
FROM statcont
WHERE prodyear = 2008
AND prodmonth = 2
AND pipeline IN
+((RPAD ('RR=I', 12)),+
+(RPAD ('RR=L', 12)),+
+(RPAD ('RR=M', 12)),+
+(RPAD ('RR=N', 12)),+
+(RPAD ('RR=O', 12)),+
+(RPAD ('RR=P', 12)),+
+(RPAD ('RR=Q', 12)),+
+(RPAD ('RR=R', 12))+
+)+
GROUP BY pipeline, prodyear, prodmonth, delmeter
UNION
SELECT pipeline, prodyear, prodmonth, recmeter AS meter,
SUM (dk1) AS cc1, SUM (dk2) AS cc2, SUM (dk3) AS cc3,
SUM (dk4) AS cc4, SUM (dk5) AS cc5, SUM (dk6) AS cc6,
SUM (dk7) AS cc7, SUM (dk8) AS cc8, SUM (dk9) AS cc9,
SUM (dk10) AS cc10, SUM (dk11) AS cc11, SUM (dk12) AS cc12,
SUM (dk13) AS cc13, SUM (dk14) AS cc14, SUM (dk15) AS cc15,
SUM (dk16) AS cc16, SUM (dk17) AS cc17, SUM (dk18) AS cc18,
SUM (dk19) AS cc19, SUM (dk20) AS cc20, SUM (dk21) AS cc21,
SUM (dk22) AS cc22, SUM (dk23) AS cc23, SUM (dk24) AS cc24,
SUM (dk25) AS cc25, SUM (dk26) AS cc26, SUM (dk27) AS cc27,
SUM (dk28) AS cc28, SUM (dk29) AS cc29, SUM (dk30) AS cc30,
SUM (dk31) AS cc31
FROM statcont
WHERE prodyear = 2008
AND prodmonth = 2
AND pipeline IN
+((RPAD ('RR=I', 12)),+
+(RPAD ('RR=L', 12)),+
+(RPAD ('RR=M', 12)),+
+(RPAD ('RR=N', 12)),+
+(RPAD ('RR=O', 12)),+
+(RPAD ('RR=P', 12)),+
+(RPAD ('RR=Q', 12)),+
+(RPAD ('RR=R', 12))+
+)+
GROUP BY pipeline, prodyear, prodmonth, recmeter)
--AAAA+
+) c+
WHERE v.pipeline = q.pipeline
AND v.meter = q.codicefisico
AND v.prodyear = q.prodyear
AND v.prodmonth = q.prodmonth
AND ( c.pipeline() = v.pipeline+
AND c.meter() = v.meter+
AND c.prodyear() = v.prodyear+
AND c.prodmonth() = v.prodmonth+
+);+
loop
fetch cur into bilancio_def_entry;
EXIT WHEN cur%notfound;
utl_file.put_line(f, bilancio.codicepool);
end loop;
utl_file.fclose(f);
CLOSE cur;
END;
+/+
Executing it I have:
ORA-06550: line 98, column 25:
Please-00103: Encountered symbol "SELECT" anziché uno dei seguenti:
+( - ++
mod not null others <an identifier>
+<a double-quoted delimited-identifier> <a bind variable> avg+
count current exists max min prior sql stddev sum variance
execute forall time timestamp interval date
+<a string literal with character set specification>+
+<a number> <a single-quoted SQL string>+
ORA-06550: riga 101, column 23:
Please-00103: Encountered symbol ")" anziché uno dei seguenti:
+; return+
returning and or
ORA-06550: line 104, colonna 25:
Please-00103: Trovato il simbolo "SELECT" anziché uno dei seguenti:
+( - ++
mod not null others <an identifier>
+<a double-quoted delimited-identifier> <a bind variable> avg+
count current exists max min prior sql stddev sum variance
ORA-06550: line 107, column 23:
Please-00103: Encountered symbol ")" anziché uno dei seguenti:
+; return+
returning and or
When i execute the query select from an sql window (not in pl sql procedure) i have no problem.
Any idea?
Please help me to come out from th problem.
Thanks

Simplified test case:
Oracle8i Enterprise Edition Release 8.1.7.4.0 - Production
With the Partitioning option
JServer Release 8.1.7.4.0 - Production
SQL> SELECT (SELECT 1
  2          FROM   DUAL) column_name
  3  FROM   DUAL;
COLUMN_NAME
          1
SQL> BEGIN
  2     FOR variable_name IN (SELECT (SELECT 1
  3                                   FROM   DUAL) column_name
  4                           FROM   DUAL) LOOP
  5        NULL;
  6     END LOOP;
  7  END;
  8  /
   FOR variable_name IN (SELECT (SELECT 1
ERROR at line 2:
ORA-06550: line 2, column 34:
PLS-00103: Encountered the symbol "SELECT" when expecting one of the following:
( - + mod not null others <an identifier>
<a double-quoted delimited-identifier> <a bind variable> avg
count current exists max min prior sql stddev sum variance
execute forall time timestamp interval date
<a string literal with character set specification>
<a number> <a single-quoted SQL string>
ORA-06550: line 3, column 47:
PLS-00103: Encountered the symbol "COLUMN_NAME" when expecting one of the
following:
) , and or
SQL>Simply put there were various 'new features' in SQL in 8i (such as analytic functions, scalar subquery as above) that were not added to PL/SQL's built-in SQL parser, so they are not supported.
Consider using them as part of a view, via dynamic SQL or otherwise use an alternative approach.

Similar Messages

  • Please update the functional specifications for Vendor Balance Report

    Dear All,
    Please update the functional specifications for Vendor Balance Report with
    proper descriptions.
    Please include
    1. How your selection screen should look like..
    2. Output format ( in an excel sheet)
    3. Logic for every field in the output format (viz. .. how do link the
    vendors from the selection screen to the BKPf and BSEG tables, how do you
    find open and closed items in BSEG , etc.)
    Please avoid statements like 'The total value of all the break-up should
    tally with the balance as shown in FBL1N for a given vendor for the given
    day.'
    You need to give the logic for the FBL1N, in that case.
    Regards
    Rama Mohan

    Hello again,
    Regarding having them update the specs, one can dream. Dreams are free. LOL. Hopefully the memory makers will update their specs as more makers start supporting a large memory configuration.
    The 4GB sticks I am using are http://shop.kingston.com/partsinfo.asp?ktcpartno=KTL-TP667/4G
    I did not do an extended test of the sticks in my MBP. Their home is in the ThinkPad I have because it is running Windows Server 2008 with Hyper-V.
    As you can see from the link above, these little suckers are pricey. But consider the price of 2GB SoDIMMs were $950 when they entered the market a couple of years ago. The price will drop.
    I asked the Kingston rep that sent these to me if online sites like newegg.com would have them soon. She indicated no, but the corporate buying sites like CDW and Zone would. So check around. They just started shipped a couple of weeks ago so be patient.
    If you have any other questions, please stop by http://blogs.technet.com/keithcombs/archive/2008/07/05/testing-my-apple-macbook- pro-with-8gb-of-ram.aspx and ask there. I'll see them much more quickly.
    Cheers,
    Keith Combs
    Microsoft

  • Please help in correcting the Decode function

    DECODE(p_resp_key,'||'''AP'''||',LINT_LOGI_STG_ITEM_DETAILS_PKG.GET_AP_ITEM_CATEGORY_DTL(ol.inventory_item_id),ldmf_istore_order_pkg.get_wwdb_prod_description(ol.inventory_item_id)) AS description
    I am getting parsing errors during runtime.I believe that something is incorrect in Decode statement.I am calling this Decopde statement in the package.Please help.
    Regards
    M

    Thanks Sven for replying i am pasting the full function kindly tell me which will be the proper manner to correct teh decode statement.Please look for "--CO73977 iStore product description change start by manish" in the belwo defintion there i have used decode function.Kindly help.
    v_statement := 'SELECT /*+ FIRST_ROWS */ DISTINCT ooh.order_number AS "Order Number",
    NVL(bill_cas.attribute5,hp.party_name) AS "Customer Name",
    TO_CHAR(ooh.ordered_date,'||'''DD-MON-YYYY'''||') AS "Order Date",
    TO_CHAR(ooh.booked_date,'||'''DD-MON-YYYY'''||') AS "Booked Date",
    TO_CHAR(ol.request_date,'||'''DD-MON-YYYY'''||') AS "Requested Date",
    oel.meaning AS "Order Status",
    ooh.cust_po_number AS "PO Number",
    ooh.transactional_curr_code AS currency,
    terms.NAME AS "Payment Terms",
    freight.meaning AS "Freight Term",
    fob.meaning AS "FOB",
    ooh.sales_channel_code AS "Sales Channel",
    bill_to.LOCATION AS "Bill To Location",
    ship_to.LOCATION AS "Ship To Location",
    terr.segment1 AS "Sales Territory - Country",
    ott.NAME AS "Order Type",
    oe_totals_grp.get_order_total (ooh.header_id,NULL,'||'''ALL'''||')* DECODE (ooh.order_category_code, '||'''RETURN'''||', -1, 1) AS "Order Total",
    CONCAT(CONCAT(ol.line_number,'||'''.'''||'),ol.shipment_number) AS "Line Number",
    ol.ordered_item AS "Item Number",
    ldmf_get_customer_item(ol.sold_to_org_id,ol.inventory_item_id,ol.invoice_to_org_id,ol.ship_to_org_id) AS "Customer SKU",
    --ldmf_istore_order_pkg.get_wwdb_prod_description(ol.inventory_item_id) AS description,
                             --CO73977 iStore product description change start by manish
                             --DECODE(p_resp_key,'||'''AP'''||',LINT_LOGI_STG_ITEM_DETAILS_PKG.GET_AP_ITEM_CATEGORY_DTL(ol.inventory_item_id),ldmf_istore_order_pkg.get_wwdb_prod_description(ol.inventory_item_id)) AS description,
              --CO73977 iStore product description change end by manish
                             LINT_LOGI_STG_ITEM_DETAILS_PKG.GET_AP_ITEM_CATEGORY_DTL(ol.inventory_item_id) AS description,
    ol.ordered_quantity AS "Ordered Quantity",
    ol.shipped_quantity AS "Shipped Quantity",
    TO_CHAR(ol.schedule_ship_date,'||'''DD-MON-YYYY'''||') AS "Schedule Ship Date",
    ol.unit_selling_price AS "Unit Price",
    ol.ordered_quantity * ol.unit_selling_price AS "Extended Amount",
    ol.tax_value "taxes_total",
    ldmf_istore_order_pkg.get_freight_charges(ooh.header_id,ol.line_id) AS "Freight Charges",
    ldmf_istore_order_pkg.get_pallet_charges (ooh.header_id,ol.line_id) AS "Pallet Surcharge",
    oe_oe_totals_summary.line_charges (ooh.header_id, ol.line_id ) AS "Total Charges",
    DECODE(oell.meaning,'||'''Awaiting Shipping'''||','||'DECODE(TO_CHAR(LDMF_ISTORE_ORDER_PKG.CHK_DELIVERY_LN_EXISTS(ol.header_id,ol.line_id)),'||
                                                                                                                  '''1'''||','||'''Picked'''||','||
                                                                                                                       '''2'''||','||'''Picked Partial'''||','||'oell.meaning)
                             ,oell.meaning) AS "Line Status",
    TO_CHAR(ol.actual_shipment_date,'||'''DD-MON-YYYY'''||') AS "Ship Date",
    (SELECT ware_house.NAME
    FROM hr_all_organization_units_tl ware_house
    WHERE ware_house.organization_id = NVL(ol.ship_from_org_id,ooh.ship_from_org_id)) AS WAREHOUSES,
    LDMF_ISTORE_ORDER_PKG.GET_TRACKING_NUMBER(ol.header_id,ol.line_id) AS "Tracking Number",
    LDMF_ISTORE_ORDER_PKG.GET_WAYBILL_NUMBER(ol.header_id,ol.line_id) AS "Waybill Number",
    LDMF_ISTORE_ORDER_PKG.GET_DELIVERY_NUMBER(ol.header_id,ol.line_id) delivery_number,
    LDMF_ISTORE_ORDER_PKG.GET_PRO_NUMBER(ol.header_id,ol.line_id) AS "Pro Number",
    LDMF_ISTORE_SALESREP_PKG.LDMF_ISTORE_CHECK_HOLDS(hcaa.cust_account_id,ooh.header_id,ol.line_id) AS "Hold Applied",
    LDMF_ISTORE_ORDER_PKG.GET_CONV_RATE(ol.ordered_item_id,ooh.org_id) AS "Pallet Qty",
    ROUND(ol.ordered_quantity/DECODE(LDMF_ISTORE_ORDER_PKG.GET_CONV_RATE(ol.ordered_item_id,ooh.org_id),0,1,LDMF_ISTORE_ORDER_PKG.GET_CONV_RATE(ol.ordered_item_id,ooh.org_id)),2) AS "Pallet#",
    ldmf_istore_order_pkg.get_invoice_number(ooh.order_number,ol.line_id) AS "Invoice Number",
    ldmf_istore_salesrep_pkg.get_promonum(ooh.header_id,ol.line_id) AS "Promo Number",
    ol.line_number,ol.shipment_number,ooh.header_id,ooh.ordered_date,
    LDMF_ISTORE_ORDER_PKG.GET_SHIP_METHOD_MEANING(ol.header_id,ol.line_id) AS SHIP_METHOD_CODE,
    terms.description AS "Payment_Term_Desc",
    TO_CHAR((LDMF_ISTORE_ORDER_PKG.GET_ESTI_ARR_DATE(ol.ACTUAL_SHIPMENT_DATE,
                             ol.SHIP_FROM_ORG_ID,
                             ol.SHIP_TO_ORG_ID,
                             ol.SHIPPING_METHOD_CODE )),'||'''DD-MON-YYYY'''||') AS "Arrival_Date",
                             DECODE (LDMF_ISTORE_ORDER_PKG.GET_ORD_AMDMT_STATUS(ooh.header_id,ol.line_id),1 ,'||'''YES'''||',NULL) AS "Pending_Approval"
    FROM oe_order_headers_all ooh,
    oe_order_lines_all ol,
    hz_cust_accounts_all hcaa,
    oe_transaction_types_all otta,
    oe_transaction_types_tl ott,
    hz_parties hp,
    hz_party_sites hps,
    oe_lookups oel,
    oe_lookups oell,
    ra_terms terms,
    fnd_lookup_values freight,
    fnd_lookup_values fob,
    wsh_new_deliveries dl,
    wsh_delivery_details dd,
    wsh_delivery_assignments da,
    oe_order_holds_all holds,
    hz_cust_site_uses_all bill_to,
    hz_cust_acct_sites_all bill_cas,
    hz_cust_site_uses_all ship_to,
    hz_cust_acct_sites_all ship_cas,
    hz_locations loc,
    ra_territories terr,
    org_organization_definitions ware_house,
    wsh_carrier_services wcs
    WHERE ooh.header_id = ol.header_id
    AND ooh.sold_to_org_id = hcaa.cust_account_id
    AND wcs.ship_method_code(+) = ol.shipping_method_code
    AND hcaa.party_id = hp.party_id
    AND hps.party_id = hp.party_id
    AND loc.location_id = hps.location_id
    AND ship_cas.party_site_id = hps.party_site_id
    AND ooh.order_type_id = otta.transaction_type_id
    AND ooh.order_type_id = ott.transaction_type_id
    AND terms.term_id(+) = ooh.payment_term_id
    AND da.delivery_id = dl.delivery_id (+)
    AND dd.delivery_detail_id = da.delivery_detail_id(+)
    AND ship_to.cust_acct_site_id = ship_cas.cust_acct_site_id
    AND ship_to.site_use_id = ooh.ship_to_org_id
    AND ware_house.organization_id(+) = ol.ship_from_org_id
    AND bill_to.cust_acct_site_id = bill_cas.cust_acct_site_id
    AND bill_to.site_use_id = ooh.invoice_to_org_id
    AND bill_to.territory_id = terr.territory_id
    AND ol.header_id = dd.source_header_id(+)
    AND ol.line_id = dd.source_line_id(+)
    AND ol.line_id = holds.line_id(+)
    AND freight.lookup_type = '||'''FREIGHT_TERMS'''||'
    AND freight.LANGUAGE =USERENV('||'''LANG'''||')
    AND freight.lookup_code = ooh.freight_terms_code
    AND ott.LANGUAGE = USERENV('||'''LANG'''||')
    AND fob.lookup_code = ooh.fob_point_code
    AND fob.lookup_type = '||'''FOB'''||'
    AND fob.LANGUAGE =USERENV('||'''LANG'''||')
    AND NVL(otta.attribute10,'||'''Y'''||') <> '||'''N'''||'
    AND oel.lookup_code = ooh.flow_status_code
    AND oel.lookup_type = '||'''FLOW_STATUS'''||'
    AND oell.lookup_code = ol.flow_status_code
    AND oell.lookup_type = '||'''LINE_FLOW_STATUS'''||'
    AND ol.line_category_code <> '||'''RETURN'''||'
    AND ooh.order_category_code IN ('||'''ORDER'''||','||'''MIXED'''||')
    AND ooh.sold_to_org_id = '||p_sold_to_org_id
    || ' AND TRUNC(ooh.ordered_date) >= TRUNC(SYSDATE - '||p_no_of_days||')';
    v_statement := v_statement || ' ORDER BY ooh.ordered_date DESC,ooh.header_id,ol.line_number,ol.shipment_number ';
    OPEN p_data FOR v_statement;
    EXCEPTION
    WHEN OTHERS THEN
    errbuf := SQLERRM ;
    retcode := SQLCODE ;
    END ORDER_TRACKER_DAYS;
    --This Procedure fetches the Order details between the given from date and to date.
    PROCEDURE ORDER_TRACKER_BETWEEN_DAYS( p_sold_to_org_id IN NUMBER
    ,p_search_by IN VARCHAR2
    ,p_start_date IN DATE
    ,p_end_date IN DATE
                             ,p_resp_key IN VARCHAR2
    ,p_data OUT shop_cartdownload
    ,errbuf OUT VARCHAR2
    ,retcode OUT NUMBER
    ) AS
    v_start_date VARCHAR2(1000);
    v_end_date VARCHAR2(1000);
    v_search_by VARCHAR2(1000);
    BEGIN
    SELECT ''''||p_start_date||'''' INTO v_start_date FROM dual;
    SELECT ''''||p_end_date||'''' INTO v_end_date FROM dual;
    v_statement := NULL;
    v_statement := 'SELECT /*+ FIRST_ROWS */ DISTINCT ooh.order_number AS "Order Number",
    NVL(bill_cas.attribute5,hp.party_name) AS "Customer Name",
    TO_CHAR(ooh.ordered_date,'||'''DD-MON-YYYY'''||') AS "Order Date",
    TO_CHAR(ooh.booked_date,'||'''DD-MON-YYYY'''||') AS "Booked Date",
    TO_CHAR(ol.request_date,'||'''DD-MON-YYYY'''||') AS "Requested Date",
    oel.meaning AS "Order Status",
    ooh.cust_po_number AS "PO Number",
    ooh.transactional_curr_code AS currency,
    terms.NAME AS "Payment Terms",
    freight.meaning AS "Freight Term",
    fob.meaning AS "FOB",
    ooh.sales_channel_code AS "Sales Channel",
    bill_to.LOCATION AS "Bill To Location",
    ship_to.LOCATION AS "Ship To Location",
    terr.segment1 AS "Sales Territory - Country",
    ott.NAME AS "Order Type",
    oe_totals_grp.get_order_total (ooh.header_id,NULL,'||'''ALL'''||')* DECODE (ooh.order_category_code, '||'''RETURN'''||', -1, 1) AS "Order Total",
    CONCAT(CONCAT(ol.line_number,'||'''.'''||'),ol.shipment_number) AS "Line Number",
    ol.ordered_item AS "Item Number",
    ldmf_get_customer_item(ol.sold_to_org_id,ol.inventory_item_id,ol.invoice_to_org_id,ol.ship_to_org_id) AS "Customer SKU",
    --ldmf_istore_order_pkg.get_wwdb_prod_description(ol.inventory_item_id) AS description,
                             --CO73977 iStore product description change start by manish
                             DECODE(p_resp_key,'||'''AP'''||',LINT_LOGI_STG_ITEM_DETAILS_PKG.GET_AP_ITEM_CATEGORY_DTL(ol.inventory_item_id),ldmf_istore_order_pkg.get_wwdb_prod_description(ol.inventory_item_id)) AS description,
              --CO73977 iStore product description change end by manish
    ol.ordered_quantity AS "Ordered Quantity",
    ol.shipped_quantity AS "Shipped Quantity",
    TO_CHAR(ol.schedule_ship_date,'||'''DD-MON-YYYY'''||') AS "Schedule Ship Date",
    ol.unit_selling_price AS "Unit Price",
    ol.ordered_quantity * ol.unit_selling_price AS "Extended Amount",
    ol.tax_value "taxes_total",
    ldmf_istore_order_pkg.get_freight_charges(ooh.header_id,ol.line_id) AS "Freight Charges",
    ldmf_istore_order_pkg.get_pallet_charges (ooh.header_id,ol.line_id) AS "Pallet Surcharge",
    oe_oe_totals_summary.line_charges (ooh.header_id, ol.line_id ) AS "Total Charges",
    DECODE(oell.meaning,'||'''Awaiting Shipping'''||','||'DECODE(TO_CHAR(LDMF_ISTORE_ORDER_PKG.CHK_DELIVERY_LN_EXISTS(ol.header_id,ol.line_id)),'||
                                                                                         '''1'''||','||'''Picked'''||','||
                                                                                              '''2'''||','||'''Picked Partial'''||','||'oell.meaning)
                             ,oell.meaning) AS "Line Status",
    TO_CHAR(ol.actual_shipment_date,'||'''DD-MON-YYYY'''||') AS "Ship Date",
    (SELECT ware_house.NAME
    FROM hr_all_organization_units_tl ware_house
    WHERE ware_house.organization_id = NVL(ol.ship_from_org_id,ooh.ship_from_org_id)) AS WAREHOUSES,
    LDMF_ISTORE_ORDER_PKG.GET_TRACKING_NUMBER(ol.header_id,ol.line_id) AS "Tracking Number",
    LDMF_ISTORE_ORDER_PKG.GET_WAYBILL_NUMBER(ol.header_id,ol.line_id) AS "Waybill Number",
    LDMF_ISTORE_ORDER_PKG.GET_DELIVERY_NUMBER(ol.header_id,ol.line_id) delivery_number,
    LDMF_ISTORE_ORDER_PKG.GET_PRO_NUMBER(ol.header_id,ol.line_id) AS "Pro Number",
    LDMF_ISTORE_SALESREP_PKG.LDMF_ISTORE_CHECK_HOLDS(hcaa.cust_account_id,ooh.header_id,ol.line_id) AS "Hold Applied",
    LDMF_ISTORE_ORDER_PKG.GET_CONV_RATE(ol.ordered_item_id,ooh.org_id) AS "Pallet Qty",
    ROUND(ol.ordered_quantity/DECODE(LDMF_ISTORE_ORDER_PKG.GET_CONV_RATE(ol.ordered_item_id,ooh.org_id),0,1,LDMF_ISTORE_ORDER_PKG.GET_CONV_RATE(ol.ordered_item_id,ooh.org_id)),2) AS "Pallet#",
    ldmf_istore_order_pkg.get_invoice_number(ooh.order_number,ol.line_id) AS "Invoice Number",
    ldmf_istore_salesrep_pkg.get_promonum(ooh.header_id,ol.line_id) AS "Promo Number",
    ol.line_number,ol.shipment_number,ooh.header_id,ooh.ordered_date,
    LDMF_ISTORE_ORDER_PKG.GET_SHIP_METHOD_MEANING(ol.header_id,ol.line_id) AS SHIP_METHOD_CODE,
    terms.description AS "Payment_Term_Desc",
    TO_CHAR((LDMF_ISTORE_ORDER_PKG.GET_ESTI_ARR_DATE(ol.ACTUAL_SHIPMENT_DATE,
                             ol.SHIP_FROM_ORG_ID,
                             ol.SHIP_TO_ORG_ID,
                             ol.SHIPPING_METHOD_CODE )),'||'''DD-MON-YYYY'''||') AS "Arrival_Date",
                             DECODE (LDMF_ISTORE_ORDER_PKG.GET_ORD_AMDMT_STATUS(ooh.header_id,ol.line_id),1 ,'||'''YES'''||',NULL) AS "Pending_Approval"
    FROM oe_order_headers_all ooh,
    oe_order_lines_all ol,
    hz_cust_accounts_all hcaa,
    oe_transaction_types_all otta,
    oe_transaction_types_tl ott,
    hz_parties hp,
    hz_party_sites hps,
    oe_lookups oel,
    oe_lookups oell,
    ra_terms terms,
    fnd_lookup_values freight,
    fnd_lookup_values fob,
    wsh_new_deliveries dl,
    wsh_delivery_details dd,
    wsh_delivery_assignments da,
    oe_order_holds_all holds,
    hz_cust_site_uses_all bill_to,
    hz_cust_acct_sites_all bill_cas,
    hz_cust_site_uses_all ship_to,
    hz_cust_acct_sites_all ship_cas,
    hz_locations loc,
    ra_territories terr,
    org_organization_definitions ware_house,
    wsh_carrier_services wcs
    WHERE ooh.header_id = ol.header_id
    AND ooh.sold_to_org_id = hcaa.cust_account_id
    AND wcs.ship_method_code(+) = ol.shipping_method_code
    AND hcaa.party_id = hp.party_id
    AND hps.party_id = hp.party_id
    AND loc.location_id = hps.location_id
    AND ship_cas.party_site_id = hps.party_site_id
    AND ooh.order_type_id = otta.transaction_type_id
    AND ooh.order_type_id = ott.transaction_type_id
    AND terms.term_id(+) = ooh.payment_term_id
    AND da.delivery_id = dl.delivery_id (+)
    AND dd.delivery_detail_id = da.delivery_detail_id(+)
    AND ship_to.cust_acct_site_id = ship_cas.cust_acct_site_id
    AND ship_to.site_use_id = ooh.ship_to_org_id
    AND ware_house.organization_id(+) = ol.ship_from_org_id
    AND bill_to.cust_acct_site_id = bill_cas.cust_acct_site_id
    AND bill_to.site_use_id = ooh.invoice_to_org_id
    AND bill_to.territory_id = terr.territory_id
    AND ol.header_id = dd.source_header_id(+)
    AND ol.line_id = dd.source_line_id(+)
    AND ol.line_id = holds.line_id(+)
    AND freight.lookup_type = '||'''FREIGHT_TERMS'''||'
    AND freight.LANGUAGE =USERENV('||'''LANG'''||')
    AND freight.lookup_code = ooh.freight_terms_code
    AND ott.LANGUAGE = USERENV('||'''LANG'''||')
    AND fob.lookup_code = ooh.fob_point_code
    AND fob.lookup_type = '||'''FOB'''||'
    AND fob.LANGUAGE =USERENV('||'''LANG'''||')
    AND NVL(otta.attribute10,'||'''Y'''||') <> '||'''N'''||'
    AND oel.lookup_code = ooh.flow_status_code
    AND oel.lookup_type = '||'''FLOW_STATUS'''||'
    AND ol.line_category_code <> '||'''RETURN'''||'
    AND ooh.order_category_code IN ('||'''ORDER'''||','||'''MIXED'''||')
    AND oell.lookup_code = ol.flow_status_code
    AND oell.lookup_type = '||'''LINE_FLOW_STATUS'''||'
    AND ooh.sold_to_org_id = '||p_sold_to_org_id ;
    IF p_search_by = '1' THEN
    v_search_by := ' AND TRUNC(ooh.ordered_date) ';
    ELSIF p_search_by = '2' THEN
    v_search_by := ' AND TRUNC(ol.request_date) ';
    ELSIF p_search_by = '3' THEN
    v_search_by := ' AND TRUNC(ol.actual_shipment_date) ';
    ELSIF p_search_by = '4' THEN
    v_search_by := ' AND TRUNC(ol.schedule_ship_date) ';
    END IF;
    v_statement := v_statement || v_search_by;
    v_statement := v_statement ||' >= '|| v_start_date || v_search_by ||' <= '||v_end_date;
    v_statement := v_statement || ' ORDER BY ooh.ordered_date DESC,ooh.header_id,ol.line_number,ol.shipment_number ';
    OPEN p_data FOR v_statement;
    EXCEPTION
    WHEN OTHERS THEN
    errbuf := SQLERRM ;
    retcode := SQLCODE ;
    END ORDER_TRACKER_BETWEEN_DAYS;

  • SQL Loader : Trim and Decode functions help please

    Hi,
    I have to load data from a flat file, for some columns i need to use TRIM and DECODE functions.It is a pipe delimited file.
    I get syntax errors (one is below) same error listed for TRIM.
    SQL*Loader-350: Syntax error at line xx.
    Expecting "," or ")", found "DECODE".
    ===========
    ,FINAL_BILL_DATE CHAR(30) "TRIM(:FINAL_BILL_DATE)"
    ,BUSINESS_ID "DECODE(:BUSINESS_ID,'B',1,'C',2,'E',3,'G',4,'O',5,'R',6,'T',7,'U',8,'H',9,-1)"
    Can anyone please help.
    Thanks
    Cherrish

    Hello Cherrish.
    The error you are receiving leads me to believe that at some point prior to the DECODE on the line for BUSINESS_ID, probably some line even before the FINAL_BILL_DATE line, there a syntactical error causing the quotes before the DECODE to actually terminate some other syntax. Without all of the lines that could actually contribute to this, including the header details, this is the best I can advise.
    Hope this helps,
    Luke
    Please mark the answer as helpful or answered if it is so. If not, provide additional details.
    Always try to provide create table and insert table statements to help the forum members help you better.

  • Wat is wrong in this decode function, it doesn get executed,please help me

    wat is wrong in this decode function, it doesn get executed,please help me
    decode(DVI.COMPANY||'.')||
                                            DECODE(DVI.COST_CENTRE||'.')||
                                            DECODE(DVI.ACCOUNT||'.')||
                                            DECODE(DVI.LOCATION||'.')||
                                            DECODE(DVI.PRODUCT||'.')||
                                            DECODE(DVI.FUTURE)company_id,

    Hi,
    I could not understand what you are trying to do with decode here.
    The standard way of using the decode is like :
    SQL>SELECT DECODE (1 , 1 ,'TRUE','FALSE') FROM DUAL;
    DECO
    TRUE
    1 row selected.
    1* SELECT DECODE (1 , 0 ,'TRUE','FALSE') FROM DUAL
    SQL>/
    DECOD
    FALSE
    1 row selected.
    Please explain what you want to do with DECODE ?
    Regards

  • I have been using GRAB to capture screen displays.  It has just stopped working since the last OSX Upgrade.  Can anyone, please help restore functionality?

    I have been using GRAB to capture screen displays.  It has just stopped working since the last OSX Upgrade.  Can anyone, please help restore functionality?

    Thanks for that.  I did as suggested but when I tried again, it still did not work.  Another  com.apple.Grab.plist appeared in the Library.
    I now have the following files in Library
    file://localhost/Users/peterpatel/Library/Preferences/com.apple.Grab.LSSharedFil eList.plist
    file://localhost/Users/peterpatel/Library/Preferences/com.apple.Grab.LSSharedFil eList.plist.lockfile
    file://localhost/Users/peterpatel/Library/Preferences/
    file://localhost/Users/peterpatel/Library/Preferences/com.apple.Grab.plist.lockf ile
    What do you suggest I do now?

  • Please convert decode query to case expression

    Please convert decode query to case expression
    Decode(Sign(id), 1, id, null) positive, Decode(Sign(id), -1, id, null) negative from dual;

    this is a serious forums that help people, if you want that we do your "homeworks" i must told you that you should pay us for that.
    Edited by: Fran on 05-jun-2013 23:41
    1002966     
    Handle:      1002966 
    Status Level:      Newbie
    Registered:      Apr 28, 2013
    Total Posts:      20
    Total Questions:      12 (12 unresolved)

  • Please help : Pipline function, error passing parameter

    Hello,
    Please help a DBA who's trying to make it with PL/SQL (on Oracle 10.2.0.4).
    I'm just building a script to find the space used by all the segments (lob, index, partitions) related to a table.
    Here is my problem, when I call a table function (DBMS_SPACE.OBJECT_DEPENDENT_SEGMENTS) from within a pipeline function i get an error,
    if I turn that function into procedure it is running fine, if I hard code parameters it works...
    When running as a function I get the error :
    SQL> Select * from table(yke_size_info('SAPRD', 'REPOSRC'));
    Select * from table(yke_size_info('SAPRD', 'REPOSRC'))
    *+
    ERROR at line 1:
    ORA-20000: Object does not exist
    ORA-06512: at "SYS.DBMS_SPACE", line 2673
    ORA-06512: at "SYS.YKE_SIZE_INFO", line 40
    => line 40 is the call to DBMS_SPACE.OBJECT_DEPENDENT_SEGMENTS
    Thank for your help, I'm getting crazy with this, I've been browsing Google & docs for hoors but no answer yet !
    create or replace type r_size_info as object (
    nb_par_tbl   number ,
    nb_idx       number ,
    nb_par_idx   number ,
    nb_lob       number ,
    used_par_tbl number ,
    used_idx     number ,
    used_par_idx number ,
    used_lob     number ,
    free_par_tbl number ,
    free_idx     number ,
    free_par_idx number ,
    free_lob     number
    +)+
    +/+
    create or replace type t_size_info as table of r_size_info;
    +/+
    CREATE OR REPLACE FUNCTION yke_size_info(o_wner varchar2, o_bject varchar2 ) RETURN t_size_info PIPELINED AS
    r_size r_size_info := r_size_info(0,0,0,0,0,0,0,0,0,0,0,0);
    obj_segment_owner   VARCHAR2(100);
    obj_segment_name    VARCHAR2(100);
    obj_segment_type    VARCHAR2(100);
    obj_tablespace_name VARCHAR2(100);
    BEGIN
    FOR obj IN (SELECT segment_owner, segment_name, segment_type, tablespace_name FROM TABLE(dbms_space.object_dependent_segments(o_wner, o_bject, NULL, 1)))*
    LOOP
    If I change that line to hard code the parameter It's working :
    FOR obj IN (SELECT segment_owner, segment_name, segment_type, tablespace_name FROM TABLE(dbms_space.object_dependent_segments('SAPSR3', 'REPOSRC', NULL, 1)))
    If I turn the function into a procedure it is working :
    CREATE OR REPLACE PROCEDURE yke_size_inf(o_wner varchar2, o_bject varchar2 ) AS
    obj_segment_owner   VARCHAR2(100);
    obj_segment_name    VARCHAR2(100);
    obj_segment_type    VARCHAR2(100);
    obj_tablespace_name VARCHAR2(100);
    BEGIN
    FOR obj IN (SELECT segment_owner, segment_name, segment_type, tablespace_name  FROM (TABLE(dbms_space.object_dependent_segments (o_wner, o_bject, NULL, 1))))*
    LOOP

    Not really sure what you are trying to achieve... and putting a pipeline function on top of another pipeline function seems unnecessary to me.
    But using the basic code you've shown, the following works fine:
    SQL> create or replace type TStrings is table of varchar2(4000);
      2  /
    Type created.
    SQL>
    SQL> create or replace function FooPipe( objectName varchar2 ) return TStrings pipelined is
      2  begin
      3          for r in (
      4                  select
      5                          segment_owner, segment_name, segment_type, tablespace_name
      6                  from    table( dbms_space.object_dependent_segments(USER, objectName , NULL, 1))
      7          )
      8          loop
      9                  pipe row( r.segment_name||' is object('||r.segment_type||') in space('||r.tablespace_name||')' );
    10          end loop;
    11
    12          return;
    13  end;
    14  /
    Function created.
    SQL>
    SQL> select * from TABLE(FooPipe('TESTTAB'));
    COLUMN_VALUE
    TESTTAB is object(TABLE) in space(USERS)
    SQL>

  • ORA-06502 while running a function in a report

    Hi guys,
    I am having a problem executing this function in my report to get the beg balance for my statment.
    any idea as why -- the error I am getting is ORA-06502
    Thanks
    =========================================================
    function CF_OPNE_BALFormula return Number is
    v_bal number;
    v_date date;
    v_prv_period number;
    BEGIN
    v_date := to_char(:P_date_from,'RRRRMM');
    if substr(v_date,5,2) = '01' then
    v_prv_period := to_number(substr(v_date,1,4)-1 ||'13');
    else
    v_prv_period := to_number(add_months(last_day(v_date),-1));
    end if;
    v_bal := csh_acc_pkg.csh_get_acc_bal(:p_own_id,:P_GLA_acc_num,to_char(v_prv_period,'RRRRMM'),'F','ACC');
    return(v_bal);
    EXCEPTION
    WHEN NO_DATA_FOUND THEN RETURN(0);
    END;
    =========================================================

    this might help:
    you have declared v_date as a date, yet you put a string into it. I believe you want it to be a string, since you use SUBSTR to determine the action required.
    So change the declaration to
    v_date varchar2( 6 )
    Furthermore the line
    v_prv_period := to_number(substr(v_date,1,4)-1 ||'13');
    has some problems, I believe.
    substr( v_date, 1, 4 )
    returns a string. You cannot calculate numbers with strings, so re-write the line:
    v_prv_period := to_number(to_number(substr(v_date,1,4)-1 ) ||'13');
    finally:
    to_char(v_prv_period,'RRRRMM')
    isn't right either, I think
    RRRRMM is a date format, whereas v_prv_period is a number.
    Oracle implicitly converts number values to strings when you assign them to a character variable, so this could be a way to call your procedure:
    v_bal := csh_acc_pkg.csh_get_acc_bal(
    :p_own_id
    , :P_GLA_acc_num
    , v_prv_period
    , 'F'
    , 'ACC' );
    Good Luck!

  • ORA-06502 Error When Calling Function

    Hi,
    We have upgraded Oracle Database Server 9i to 11.1.0.7 and we are now using ODP.NET version 2.112.2.0 instead of 9.2.0.4 dll.
    After the migration, we encountered ORA-06502 problem when we are calling a function from .NET application. We investigated and found that we have to set the parameter size for the return value parameter (varchar2). But there is a strange case that how do we guess the return value size, it can be 5 characters or 5.000 characters. Before 11g Oracle.DataAccess, we do not have that such problem. We were setting the parameter size 225 by default, but ODP.NET was returning 500 characters without any error.
    The question is that how do we guess or know the actual parameter size when we are passing a Return Value parameter to the function?
    Or is there a solution for this behaviour of ODP.NET?
    Thanks.

    Is there a reason you can not set it to the default maximum size for a varchar2 of 32k?
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using Oracle.DataAccess.Client;
    using System.Data;
    namespace test_function2
    class Program
    static void Main(string[] args)
    OracleConnection con = new OracleConnection("Data Source=UTF8;User ID=scott;Password=tiger");
    OracleCommand cmd = new OracleCommand("test_return", con);
    cmd.CommandType = CommandType.StoredProcedure;
    OracleParameter test_return = new OracleParameter("test_return", OracleDbType.Varchar2, 32000);
    test_return.Direction = ParameterDirection.ReturnValue;
    cmd.Parameters.Add(test_return);
    OracleParameter test_input = new OracleParameter("test_input", OracleDbType.Varchar2);
    test_input.Direction = ParameterDirection.Input;
    test_input.Value = "blah";
    cmd.Parameters.Add(test_input);
    try
    con.Open();
    cmd.ExecuteNonQuery();
    con.Close();
    Console.WriteLine("{0}", test_return.Value);
    Console.WriteLine("Press Enter to Continue");
    Console.ReadLine();
    catch (OracleException e)
    Console.WriteLine(e.Number);
    Console.WriteLine(e.Message);
    Console.WriteLine("test failed\nPress Enter to Continue");
    Console.ReadLine();
    create or replace function test_return(in_var in varchar2)
    return varchar2 is
    begin
    return lpad(in_var, 4000, 'TEST test') || lpad(in_var, 4000, 'DONE done');
    end test_return;
    /

  • Itunes  please help with functions (possible or not???)

    Hello
    I´m sorry that my questions are a little long - but please please i´m new with IPod and ITunes - and well at the moment i feel like if i had known how unorganized ITunes is and that i can´t acces the data on my IPod directly i would perhaps not have bought the IPod at all... (but perhaps - i really really hope so - i just cant find out HOW to do all i want and it IS possible after all...) so please take the time and if you know the ansers tell me how to do that...
    Since yesterday i have an IPod classic but unfortunately my own computer has only Windows 2000 - so i have to sync/transfer the Data from my Mom´s PC and so i have to delete the data on her PC after i got them on the IPOD once (and the should stay there untill i´m ready to delete them...)
    1)
    a) what happens if i sync my ITunes/Ipod and i allready deletet most of the music on my moms PC - will the music on the IPod be deleted too? - If yes can i prevent that? (how?)
    b) can i manually choose which titles i want to add/remove to/from my Ipod? i can´t see any way at the moment !!!
    I can see a kind of inventory list of my IPod but i can´t find out how to move Data on/in the folders of the IPod - only by synchronisation - now i know i HAVE allready Data on the IPod but every folder in Itunes of my Ipod is Empty... so how can i acces these data please???
    2)
    My second Problem ist that i can´t find out how to "sort" my chaotic 10.0000 (ok ok not so many right now but getting there some time) different Music-Data into different folders - ok i could add them to diffrent playlists - but one of the main Problems is the fact that many of my data are not properly classified so i need to organize the music so that i "see" only the Music from one particulary folder of my harddisk (then uppdate those information like adding all data from that Folder to a personal "album" or similar...) and every time i add a folder to the mediathek all the songs (different artist, different albums, different everything or missing information) are then spread out all through the music folder and i have to manually search for every single on and then manually add it to a playlist which is more timeconsuming than it is worth it...
    So please help me - HOW DO i make new Folders (NOT PLAYLISTS!!!) in which to sort the music??? so i do not have only ONE Music-Folder but perhaps 2, oder 3 or later more subfolders under the music-Folder?
    If that is really not possible - can i then at least sort my music after path-name (haven´t found out how to do that either yet...)
    3) I have a folder audibooks (which is really really great since i´m an audible customer and have moren then 40 audiobooks allready...) and my audible audiobooks are all added to that folder...
    But i have a few Other Audiobooks in MP3-Format (from MP3 DVD/ and a few CD´s formated as MP3) and even after i uppdated the information so it say´s now audibook in Type - i just can´t find out how to transfer those audibooks to the audiobooks folder (they stay in music-folder and are not found by Ipod as audibooks - only accessible under music with type audibooks which really ***** because that is unnecessary complicated... )
    so how do i get thos books in the audiobooks folder please?
    I hope anyone can help me...
    best regards
    Skarinija
    Message was edited by: Skarinija

    Thanks very much that takes care o my Question 1:
    It really is a great relief so now i know can sync the IPod manually - basically i tried the right things but in the wrong order - lol so i accidently deletet everthing on the IPod again and then i was staring on the blank inventory of my Ipod and wondering why i could not access the music that should be there...
    Still anyone knows an answer to question 2 and 3
    2) is it possible to "sort" Itunes in subfolders - so i can acces only one folder at a time
    3) Is ist possible to somehow classify any type of MP3/similar Data as "audibook" so that Data will show up as audibook on the Ipod? (not as music with type audiobook)
    mfg
    Skarinija

  • ORA-03113 error with sdo_difference function

    Hi,
    I am trying to find the topological difference between geometries in two tables, using the sdo_difference function. For certain geometries, I am getting the "ORA-03113: end-of-file on communication channel" error.
    All my geometries are valid and are in the same projection.
    I am not able to track down why exactly this is happening. My hunch is that this occurs when there is an exact match between two geometries.
    Has anyone come across this problem before?
    Thanks in advance.
    Cheers,
    Sundar.

    My client is using 8.1.6 and I was having the same problem. The geometries I'm using are machine built (translated from Intergraph drawings) and they have complex geometries with individual lines.
    I increased my TOLERANCE from 0.0000000005 to 0.000005 metres and the problem was disappeared.
    The same workaround fixed problems I was having with SDO_INTERSECTION as well.

  • ORA-04091: is mutating, trigger/function may not see

    I am getting this error
    ORA-04091: table SATURN.SARQUAN is mutating, trigger/function may not see it
    ORA-06512: at "BANINST1.F_GETSARQUANSEQNO", line 24
    ORA-06512: at "BANINST1.F_GETSARQUANSEQNO", line 30
    I am trying to do this insert
    INSERT INTO sarquan
                            (sarquan_pidm,sarquan_term_code_entry,sarquan_seqno,
                             sarquan_appl_no, sarquan_question,
                             sarquan_answer, sarquan_activity_date,
                             sarquan_user_id
                    SELECT spriden_pidm,'201090',BANINST1.F_GETSARQUANSEQNO(spriden_pidm,'201090','1'),'1',
                     'Would you prefer September admission?',
                    DECODE (szcasup_sept_adm, 'Y', 'Yes', 'N', 'No'),sysdate,'rmanoei'
               FROM saturn_midd.szcasup, saturn.spriden
              WHERE spriden_id = szcasup_common_appl_id
                AND spriden_ntyp_code = 'CAPP'
                AND (   szcasup_sept_adm IS NOT NULL
                     OR szcasup_feb_adm IS NOT NULL
                     OR szcasup_interview IS NOT NULL
                AND NOT EXISTS (
                       SELECT *
                         FROM  sarquan
                        WHERE sarquan_pidm = spriden_pidm
                          AND spriden_ntyp_code = 'CAPP'
                          AND sarquan_term_code_entry = '201090');
                          I got data when I ran just the select statement, none of the records have data in the sarquan table.
    I got data when I select from this function
    ,BANINST1.F_GETSARQUANSEQNO(spriden_pidm,'201090','1'),'1'
    Any ideas?
    Edited by: peace4all on Aug 12, 2009 4:49 PM

    I can not drop the trigger, I don't own the trigger, it is in production, SARQUAN is a production table
    Now I am getting this error ORA-04091: table SATURN.SARQUAN is mutating, trigger/function may not see it
    ORA-06512: at "BANINST1.F_GETSARQUANSEQNO", line 24
    ORA-06512: at "BANINST1.F_GETSARQUANSEQNO", line 30
    ORA-06512: at "SATURN.ST_SARQUAN_INSERT_ROW", line 2
    ORA-04088: error during execution of trigger 'SATURN.ST_SARQUAN_INSERT_ROW'
    when I do the following
    I know that this pidm does not have any records in the table SARQUAN
    spriden_pidm = 2287953
    So I try to do a simple insert, not using the function, now I am hardcoding the seq, I know it needs to be 1 since there are not records in that table yet,
    the sequence go by pidm
    INSERT INTO saturn.sarquan
                     sarquan_pidm,
                     sarquan_seqno,
                     sarquan_term_code_entry,
                     sarquan_appl_no,
                      sarquan_question,
                     sarquan_answer,
                     sarquan_activity_date,
                     sarquan_user_id
    SELECT spriden_pidm,'1',
    '201090','1',
                     'Would you prefer September admission?',
                    DECODE (szcasup_sept_adm, 'Y', 'Yes', 'N', 'No'),sysdate,'recheverri'
               FROM saturn_midd.szcasup, saturn.spriden
              WHERE spriden_id = szcasup_common_appl_id
                AND spriden_ntyp_code = 'CAPP'
                 and spriden_pidm = 2287953
                AND (   szcasup_sept_adm IS NOT NULL
                     OR szcasup_feb_adm IS NOT NULL
                     OR szcasup_interview IS NOT NULL
                AND NOT EXISTS (
                       SELECT *
                         FROM saturn.sarquan
                        WHERE sarquan_pidm = spriden_pidm
                          AND spriden_ntyp_code = 'CAPP'
                          AND sarquan_term_code_entry = '201090');
                          Edited by: peace4all on Aug 13, 2009 5:35 AM

  • Ora-06502 while calling oracle function

    I am using 9.2.0.4.0 database.
    I have vb.net application that uses oracle provider for .net to connect to database.
    I am calling Oracle function which returns varchar2 value back.
    when i execute cmd2.ExecuteNonQuery, I get ora-06502 error.
    CREATE OR REPLACE FUNCTION ZZZ_TEMP( p_val IN VARCHAR2) RETURN varchar2
    AS
    BEGIN
    RETURN 'HELLO';
    EXCEPTION WHEN OTHERS THEN
    RETURN SQLCODE||' - '||SUBSTR(SQLERRM,1,100);
    END;
    ************** vb.net code
    Dim cmd2 As New Oracle.DataAccess.Client.OracleCommand(UserSchemaName & ".ZZZ_TEMP", con)
    Dim VAL As String
    Try
    cmd2.Parameters.Add("RetVal", Oracle.DataAccess.Client.OracleDbType.Varchar2, ParameterDirection.ReturnValue)
    cmd2.Parameters.Add("p_val", Oracle.DataAccess.Client.OracleDbType.Varchar2, ParameterDirection.Input).Value = "XYZ"
    cmd2.Connection = con
    cmd2.CommandType = CommandType.StoredProcedure
    cmd2.ExecuteNonQuery()
    VAL = cmd2.Parameters("RetVal").Value
    Catch ex As Oracle.DataAccess.Client.OracleException
    MsgBox(ex.Message)
    End Try

    If I change this function to retrun number rather than Varchar2 and change my
    RetVal parameter as follow it works. I am noticing that there might be a bug when function returns varchar2
    cmd2.Parameters.Add("RetVal", Oracle.DataAccess.Client.OracleDbType.int32, ParameterDirection.ReturnValue)
    cmd2.Parameters.Add("p_Val", Oracle.DataAccess.Client.OracleDbType.int32, ParameterDirection.Input).valu ="XYZ"

  • Getting ORA-00600 when using table functions

    Hello,
    I am trying to use simple table function:
    create or replace type StatCall AS OBJECT (
    dial_number varchar2(255),
    start_date date,
    duration number(20)
    create or replace type StatCallSet AS TABLE OF StatCall;
    create or replace package ref IS
    type refcall_t IS REF CURSOR RETURN calls%ROWTYPE;
    end ref;
    create or replace function GetStats(p ref.refcall_t) return StatCallSet pipelined is
    out_rec StatCall;
    in_rec p%ROWTYPE;
    BEGIN
    LOOP
    FETCH p INTO in_rec;
    EXIT WHEN p%NOTFOUND;
    out_rec.dial_number := in_rec.dial_number;
    out_rec.start_date := in_rec.start_date;
    out_rec.duration := in_rec.duration;
    PIPE ROW(out_rec);
    END LOOP;
    CLOSE p;
    RETURN;
    END;
    select * from TABLE(GetStats(CURSOR(select * from call)));
    And I get:
    ORA-00600: internal error code, arguments: [17285], [0xFFFFFFFF7C4900A8], [1], [0x3943BA5E0], [], [], [], []
    Oracle 9.2.0.2
    Are there any ideas about how to fix this?

    What version of the database?
    Which flavor of Disco (Plus, Desktop, Viewer)?
    Standars EUL or Apps EUL?
    Can you post the code for the calculation?
    ORA-600 errors, as you mentioned, are internal, and may require opening a dialog with Oracle support. Then again, it could be something else in the calculation that is causing the sky to fall.

Maybe you are looking for