Keyword not found where expected - in PL/SQL ONLY.

Hello

I use Oracle 10.2.0.3 on Windows 7 on laptop using Toad.

The following SQL code selects the PK and FK views columns DBA.
It is running very well and gives the desired result.
WITH temp AS (
select rownum RN, R_constraint_name pk, constraint_name fk
from user_constraints 
where constraint_type = 'R'
--and table_name = 'EMPLOYEES'
)
select pk.tname "PK Table", pk.cname "PK Column", fk.tname "FK Table", fk.cname "FK Column", decode(pk.tname, fk.tname,'Self Join', 'Equi Join') "Join Type"
from
(
select t.rn RN, u.table_name tname, u.column_name cname
FROM user_cons_columns u, temp t
where u.constraint_name = t.pk
) PK,
(    
select t.rn RN, u.table_name tname, u.column_name cname
FROM user_cons_columns u, temp t
where u.constraint_name = t.fk
) FK    
WHERE pk.RN=fk.RN(+)
ORDER BY 1, 3
Whenever I put the same query in a PL/SQL block, I get the following error:
< font color = "red" >
ORA-06550: line 19, column 44:
PL/SQL: ORA-00923: KEYWORD not found where expected
ORA-06550: line 13, column 1:
PL/SQL: SQL statement ignored
< / make >


DECLARE

TYPE OBJ_DETAIL_TYPE IS TABLE OF VARCHAR2(30);
v_pk_tname    OBJ_DETAIL_TYPE;
v_pk_cname    OBJ_DETAIL_TYPE;
v_fk_tname    OBJ_DETAIL_TYPE;
v_fk_cname    OBJ_DETAIL_TYPE;
v_join_type   OBJ_DETAIL_TYPE;

BEGIN

--*****************************************************
WITH temp AS (
select rownum RN, R_constraint_name pk, constraint_name fk
from user_constraints 
where constraint_type = 'R'
--and table_name = 'EMPLOYEES'
)
select pk.tname into v_pk_tname , pk.cname into v_pk_cname, fk.tname into v_fk_tname, fk.cname into v_fk_cname, decode(pk.tname, fk.tname,'Self Join', 'Equi Join') into v_join_type
from
(
select t.rn RN, u.table_name tname, u.column_name cname
FROM user_cons_columns u, temp t
where u.constraint_name = t.pk
) PK,
(    
select t.rn RN, u.table_name tname, u.column_name cname
FROM user_cons_columns u, temp t
where u.constraint_name = t.fk
) FK    
WHERE pk.RN=fk.RN(+)
ORDER BY 1, 3;
--*****************************************************

END;
/
Surely I'm missing something, a limitation in PL/SQL syntax, perhaps.

Can someone guide me please on this...

Thank you in advance.

Kind regards.

Here's your resolution:

Hoping that you will get your solution less change.

DECLARE

TYPE OBJ_DETAIL_TYPE IS TABLE OF VARCHAR2(30);
v_pk_tname    OBJ_DETAIL_TYPE;
v_pk_cname    OBJ_DETAIL_TYPE;
v_fk_tname    OBJ_DETAIL_TYPE;
v_fk_cname    OBJ_DETAIL_TYPE;
v_join_type   OBJ_DETAIL_TYPE;

BEGIN

--*****************************************************
WITH temp AS (
select rownum RN, R_constraint_name pk, constraint_name fk
from user_constraints
where constraint_type = 'R'
--and table_name = 'EMPLOYEES'
)
select pk.tname, pk.cname, fk.tname, fk.cname, decode(pk.tname, fk.tname,'Self Join', 'Equi Join') bulk collect into v_pk_tname, v_pk_cname, v_fk_tname, v_fk_cname, v_join_type
from
(
select t.rn RN, u.table_name tname, u.column_name cname
FROM user_cons_columns u, temp t
where u.constraint_name = t.pk
) PK,
(
select t.rn RN, u.table_name tname, u.column_name cname
FROM user_cons_columns u, temp t
where u.constraint_name = t.fk
) FK
WHERE pk.RN=fk.RN(+)
ORDER BY 1, 3;
--*****************************************************

END;
/ 

Regards,
P.

Tags: Database

Similar Questions

  • PL/SQL error: ORA-00923: KEYWORD not found where expected

    Hi all

    I get this error when I generate the code mentioned bellow.

    Error of calculation of the value of the default element for the element on the page P1_JORNADA_ANUAL.

    ORA-06550: line 42, column 17: PL/SQL: ORA-00923: THE KEYWORD not found where expected to ORA-06550: line 8, column 1: PL/SQL: statement ignored


    Code:


    --------------------------------------------------------------------------------------------

    DECLARE

    L_EMPRESA B_LISTA_EMPLEADOS. EMPRESA % TYPE;

    BEGIN

    Select case when ((select EMPRESA

    of B_LISTA_EMPLEADOS

    where USERNAME = v('APP_USER'))) = "EMPRESA1".

    then ((select to_char (JORNADA_ANUAL)

    of B_JORNADAS_Y_RATIOS

    where CATEGORY = (())

    Select the CATEGORY

    of B_LISTA_EMPLEADOS

    where username = v('APP_USER')

    ))

    and EMPRESA = (())

    Select the EMPRESA

    of B_LISTA_EMPLEADOS

    where username = v('APP_USER')

    ))

    and ANO = v ('P1_ANO')

    ))

    When ((select EMPRESA

    of B_LISTA_EMPLEADOS

    where USERNAME =: APP_USER)) = "EMPRESA2".

    then "EMPRESA2 Jornada.

    When ((select EMPRESA

    of B_LISTA_EMPLEADOS

    where USERNAME =: APP_USER)) = "EMPRESA3".

    then "EMPRESA3 Jornada.

    else 'Empresa desconocida '.

    end

    in L_EMPRESA

    like the Jornada

    of B_JORNADAS_Y_RATIOS

    The COMPANY group

    RETURN L_EMPRESA;

    EXCEPTION

    WHEN NO_DATA_FOUND THEN

    RETURNS A NULL VALUE.

    END;

    --------------------------------------------------------------------------------------------


    Does anyone know who or where is the error?


    Thank you very much.


    Concerning


    Also

    Check this box...

    IN

    L_EMPRESA AS Jornada

    you send a value to the variable, if no name alias need here.

    use like this.

    IN

    L_EMPRESA

    Of

  • java.sql.SQLException: ORA-00923: KEYWORD not found where expected

    Hi all

    I wrote a stored procedure where I variables defined for selectColumn, fromClause and whereClause and I'm paasing to another procedure.
    But, while running, I get an error:

    "java.sql.SQLException: ORA-00923: KEYWORD not found where expected.


    XL_SPG_GetPagingSql (strColumnList,
    strFromClause,
    strWhereClause,
    strOrderByClause,
    intSortDirection_in,
    intStartRow_in,
    intPageSize_in,
    select_stmt);

    Please advice

    I think so.

    You will want to ensure that columns used in ORDER BY are listed in the SELECT statement since you use SEPARATE.

  • ORA-00923: THE KEYWORD not found where expected

    Getting an error in a function:
    FUNCTION gross_sal 
      (emp_no IN NUMBER)
       RETURN NUMBER
      IS
       emp_before_tax Number;
     BEGIN
      SELECT
        emp.Sal  coalesce(ed.Deduction_amount,0) result
      INTO  emp_before_tax
      FROM  emp emp                                             --****ORA-00923: FROM keyword not found where expected****
        LEFT JOIN Emp_Deductions ed ON ed.fk_empno = emp.EmpNo
         AND ed.Before_or_After_Flag = 'B';
      EXCEPTION
        WHEN NO_DATA_FOUND THEN
         DBMS_OUTPUT.PUT_LINE('Employee has no salary listed.');
     END gross_sal;
    It's a small piece of a package can list the tables and if necessary rest.
    emp.Sal  coalesce(ed.Deduction_amount,0) result
    

    an operator is missing between the two, WHERE the...

    In addition, to add... BACK is missing in your pl/sql code.

    Concerning
    Biju

  • ORA-00923: keyword not found where expected

    I am moving a MS SQL to Oracle database and having some problems with the code below.


    SELECT TOP 5
    STAFF. PNAME AS PNAME,
    sum ("SALES_ORDER". "ITEMS_NET") AS SumSales "
    Of
    ("ACCOUNT_MANAGERS"INNER JOIN "SALES_ORDER" ON 'SALES_ORDER'." ACCOUNT_REF"="ACCOUNT_MANAGERS. " ("' INNER JOIN ACCOUNT_REF STAFF") ON "ACCOUNT_MANAGERS". PREF = STAFF. PREF
    WHERE
    "SALES_ORDER". "" ORDER_OR_QUOTE "="command ".
    GROUP BY
    STAFF. PNAME
    HAVING
    sum ("SALES_ORDER". "ITEMS_NET") > 5000 "

    whenever I run it I get the error ORA-00923: keyword not found where expected can help anyone?

    TOP 5 isn't a syntax valid oracle

  • Error with subquery - keyword not found where expected

    Hello

    I have some difficulties with a query that contains multiple subqueries. I receive the error: oracle ORA-00923: KEYWORD not found where expected

    After much troubleshooting, I still was not able to determine the cause of this error. All the work of subqueries individually, but once combined, it error.

    Can you see what I did wrong? Any help is greatly appreciated,

    SELECT qryAllocations.CUSTOMER_CODE, qryAllocations.CUST_SHORT AS roaster, qryAllocations.CUSTOMER_NAME,

    qryAllocations.ITEM_NAME, qryAllocations.CONC_SO_NUMBER, qryAllocations.POSITION_NAME, qryAllocations.SPOT_YN,

    qryAllocations.PO_NUMBER, qryAllocations.CONC_PO_NUMBER, qryAllocations.Bags AS Allocated, qryAllocations.Lbs bags AS allocated, Lbs

    qryAllocations.DELVPERIOD_FROM, qryAllocations.DELVPERIOD_TO, qryInvoicesSumBySO.SumOfDELI_BAGS AS charged, bags

    qryInvoicesSumBySO.SumOfNET_QTY HAVE charged Lbs, qryInvoicesSumBySO.MinOfINVOICE_DATE, qryInvoicesSumBySO.MaxOfINVOICE_DATE, qryAllocations.REP

    Of

    (

    SELECT CO_SORDER. SO_PREFIX, CO_SORDER. SO_NUMBER, CO_ITEM. SHORT_NAME, CO_ITEM. NOM_ELEMENT,

    CO_SORDER. SO_SUFFIX, CO_SORDER. SO_PREFIX | '-' || CO_SORDER. SO_NUMBER | '-' || CO_SORDER. SO_SUFFIX AS CONC_SO_NUMBER,

    CO_POSITION. POSITION_NAME, CO_POSITION. SPOT_YN, qryAllocationsGrouper.SumOfPO_ALLOC_QTY AS bags, SumOfQTY_ALLOC * 2204.62 Lbs AS.

    CO_SORDER. DELVPERIOD_FROM, CO_SORDER. DELVPERIOD_TO, CO_SORDER. PRICE,

    CO_PORDER. PO_PREFIX | '-' || CO_PORDER. PO_NUMBER | '-' || CO_PORDER. PO_SUFFIX AS CONC_PO_NUMBER, CO_PORDER. PO_NUMBER,

    CO_PORDER. PO_SUFFIX, CO_PORDER. PRICE AS PO_PRICE, CO_SORDER. CUSTOMER_CODE, CO_CUSTOMER. SHORT_NAME AS CUST_SHORT,

    CO_CUSTOMER. CLIENT_NAME, CO_SORDER. ORDER_DATE, qryAllocationsGrouper.SO_KEY, qryAllocationsGrouper.PO_KEY, GN_USERS. SHORT_NAME AS REP,

    CO_SORDER. STATUS

    OF CO_ORIGIN

    JOIN INTERNAL (INNER JOIN CO_ITEM (((CO_SORDER INNER JOIN CO_CUSTOMER ON CO_SORDER. CUSTOMER_CODE = CO_CUSTOMER. CUSTOMER_CODE)

    JOIN INTERNAL (INNER JOIN CO_PORDER

    (

    SELECT CO_ALLOCATION_TAIL. PO_KEY, CO_ALLOCATION_TAIL. SO_KEY, Sum (CO_ALLOCATION_TAIL. QTY_ALLOC) AS SumOfQTY_ALLOC,

    Sum (CO_ALLOCATION_TAIL. PO_ALLOC_QTY) AS SumOfPO_ALLOC_QTY, Min (CO_ALLOCATION_TAIL. ALLOC_DATE) AS MinOfALLOC_DATE,

    Max (CO_ALLOCATION_TAIL. ALLOC_DATE) AS MaxOfALLOC_DATE, CO_SORDER. STATUS

    FROM CO_ALLOCATION_TAIL INNER JOIN CO_SORDER ON CO_ALLOCATION_TAIL. SO_KEY = CO_SORDER. SO_KEY

    GROUP OF CO_ALLOCATION_TAIL. PO_KEY, CO_ALLOCATION_TAIL. SO_KEY, CO_SORDER. STATUS

    HAVE (((CO_SORDER. (STATUS) = "O"))

    ) qryAllocationsGrouper

    ON CO_PORDER. PO_KEY = qryAllocationsGrouper.PO_KEY)

    ON CO_SORDER. SO_KEY = qryAllocationsGrouper.SO_KEY) INNER JOIN GN_USERS ON CO_SORDER. ENTERED_USER = GN_USERS. USER_ID)

    INNER JOIN CO_POSITION ON CO_SORDER. POSITION = CO_POSITION. POSITION_CODE) ON CO_ITEM. ITEM_CODE = CO_PORDER. ITEM_CODE)

    ON CO_ORIGIN. ORIGIN_CODE = CO_ITEM. ORIGIN_CODE

    WHERE (((CO_SORDER. (STATUS) = "O"))

    ORDER OF CO_PORDER. PO_NUMBER / / DESC

    ) qryAllocations

    LEFT JOIN

    (

    SELECT qryInvoices.PO_KEY, qryInvoices.SO_KEY, qryInvoices.SHORT_NAME, qryInvoices.CUSTOMER_NAME, qryInvoices.CONC_SO_NUMBER, qryInvoices.CONC_PO_NUMBER,

    Sum (qryInvoices.DELI_BAGS) as SumOfDELI_BAGS, Sum (qryInvoices.NET_QTY) AS SumOfNET_QTY, Min (qryInvoices.INVOICE_DATE) as MinOfINVOICE_DATE,

    Max (qryInvoices.INVOICE_DATE) AS MaxOfINVOICE_DATE

    Of

    (

    SELECT CO_FINAL_INVOICE. INVOICE_NUMBER, CO_FINAL_INVOICE. INVOICE_DATE, CO_TRF_DELIVERY. DELI_NO, CO_TRF_DELIVERY. DELI_DATE,

    CO_PAYTERMS. PAYTERMS_NAME, CO_FINAL_INVOICE. END_DATE, CO_CUSTOMER. SHORT_NAME, CO_CUSTOMER. CLIENT_NAME,

    CO_FINAL_INVOICE. INVOICE_FINAL_AMOUNT, CO_FINAL_INVOICE. PAYTERMS_CODE, CO_TRF_DELICONTAINER. DELI_BAGS, CO_FINAL_INVOICE_DETAIL.NET_QTY,

    CO_FINAL_INVOICE_DETAIL. INV_PRICE, CO_SORDER. SO_PREFIX | '-' || CO_SORDER. SO_NUMBER | '-' || CO_SORDER. SO_SUFFIX AS CONC_SO_NUMBER,

    CO_PORDER. PO_PREFIX | '-' || CO_PORDER. PO_NUMBER | '-' || CO_PORDER. PO_SUFFIX AS CONC_PO_NUMBER, CO_ORIGIN. SHORT_NAME AS ORIGIN,

    CO_ITEM. SHORT_NAME AS ITEM_SHORT, CO_ITEM. ITEM_DESCRIPTION, CO_PORDER. CHARACTERISTICS OF CO_TRF_DELIVERY. PAID_BY,

    CO_FINAL_INVOICE_DETAIL. DELI_CODE, CO_FINAL_INVOICE_DETAIL.TR_KEY, CO_FINAL_INVOICE. INVOICE_KEY, CO_TRF_DELIVERY. MDO_KEY,

    CO_PORDER. PO_KEY, CO_SORDER. SO_KEY, CO_FINAL_INVOICE. CANCELED_YN

    OF (((CO_FINAL_INVOICE INNER JOIN CO_FINAL_INVOICE_DETAIL ON CO_FINAL_INVOICE. INVOICE_KEY = CO_FINAL_INVOICE_DETAIL. INVOICE_KEY)

    INNER JOIN CO_CUSTOMER ON CO_FINAL_INVOICE. BUYER_CODE = CO_CUSTOMER. CUSTOMER_CODE)

    JOIN INTERNAL CO_TRF_DELIVERY

    ON (CO_FINAL_INVOICE_DETAIL. SO_KEY = CO_TRF_DELIVERY. SO_KEY)

    AND (CO_FINAL_INVOICE_DETAIL.TR_KEY = CO_TRF_DELIVERY.TR_KEY)

    AND (CO_FINAL_INVOICE_DETAIL. DELI_CODE = CO_TRF_DELIVERY. DELI_CODE))

    INNER JOIN CO_SORDER ON (CO_CUSTOMER. CUSTOMER_CODE = CO_SORDER. CUSTOMER_CODE)

    AND (CO_FINAL_INVOICE_DETAIL. SO_KEY = CO_SORDER. CO_PORDER INNER JOIN SO_KEY))

    ON CO_TRF_DELIVERY. PO_KEY = CO_PORDER. CO_PAYTERMS INNER JOIN PO_KEY)

    ON CO_FINAL_INVOICE. PAYTERMS_CODE = CO_PAYTERMS. CO_TRF_DELICONTAINER INNER JOIN PAYTERMS_CODE)

    ON CO_TRF_DELIVERY. DELI_CODE = CO_TRF_DELICONTAINER. JOIN IN-HOUSE DELI_CODE) (CO_ORIGIN INNER JOIN CO_ITEM

    ON CO_ORIGIN. ORIGIN_CODE = CO_ITEM. ORIGIN_CODE) ON CO_SORDER. ITEM_CODE = CO_ITEM. ITEM_CODE

    GROUP OF CO_FINAL_INVOICE. INVOICE_NUMBER, CO_FINAL_INVOICE. INVOICE_DATE, CO_TRF_DELIVERY. DELI_NO,

    CO_TRF_DELIVERY. DELI_DATE, CO_PAYTERMS. PAYTERMS_NAME, CO_FINAL_INVOICE. END_DATE, CO_CUSTOMER. SHORT_NAME,

    CO_CUSTOMER. CLIENT_NAME, CO_FINAL_INVOICE. INVOICE_FINAL_AMOUNT, CO_FINAL_INVOICE. PAYTERMS_CODE,

    CO_TRF_DELICONTAINER. DELI_BAGS, CO_FINAL_INVOICE_DETAIL.NET_QTY, CO_FINAL_INVOICE_DETAIL. INV_PRICE,

    CO_SORDER. SO_PREFIX | '-' || CO_SORDER. SO_NUMBER | '-' || CO_SORDER. SO_SUFFIX,

    CO_PORDER. PO_PREFIX | '-' || CO_PORDER. PO_NUMBER | '-' || CO_PORDER. PO_SUFFIX, CO_ORIGIN. SHORT_NAME,

    CO_ITEM. SHORT_NAME, CO_ITEM. ITEM_DESCRIPTION, CO_PORDER. CHARACTERISTICS OF CO_TRF_DELIVERY. PAID_BY,

    CO_FINAL_INVOICE_DETAIL. DELI_CODE, CO_FINAL_INVOICE_DETAIL.TR_KEY, CO_FINAL_INVOICE. INVOICE_KEY,

    CO_TRF_DELIVERY. MDO_KEY, CO_PORDER. PO_KEY, CO_SORDER. SO_KEY, CO_FINAL_INVOICE. CANCELED_YN

    HAVE (((CO_FINAL_INVOICE. CANCELED_YN) Is Nothing))

    ORDER OF CO_FINAL_INVOICE. INVOICE_NUMBER / / DESC

    ) qryInvoices

    GROUP OF qryInvoices.PO_KEY, qryInvoices.SO_KEY, qryInvoices.SHORT_NAME, qryInvoices.CUSTOMER_NAME, qryInvoices.CONC_SO_NUMBER, qryInvoices.CONC_PO_NUMBER

    ) qryInvoicesSumBySO

    WE (qryAllocations.PO_KEY = qryInvoicesSumBySO.PO_KEY) AND (qryAllocations.SO_KEY = qryInvoicesSumBySO.SO_KEY)

    ORDER BY qryAllocations.DELVPERIOD_TO

    No test!

    SELECT qryAllocations.CUSTOMER_CODE,

    qryAllocations.CUST_SHORT AS roaster,

    qryAllocations.CUSTOMER_NAME,

    qryAllocations.ITEM_NAME,

    qryAllocations.CONC_SO_NUMBER,

    qryAllocations.POSITION_NAME,

    qryAllocations.SPOT_YN,

    qryAllocations.PO_NUMBER,

    qryAllocations.CONC_PO_NUMBER,

    qryAllocations.Bags AS BagsAllocated,

    qryAllocations.Lbs AS LbsAllocated,

    qryAllocations.DELVPERIOD_FROM,

    qryAllocations.DELVPERIOD_TO,

    qryInvoicesSumBySO.SumOfDELI_BAGS AS BagsInvoiced,

    qryInvoicesSumBySO.SumOfNET_QTY AS LbsInvoiced,

    qryInvoicesSumBySO.MinOfINVOICE_DATE,

    qryInvoicesSumBySO.MaxOfINVOICE_DATE,

    qryAllocations.REP

    FROM (SELECT CO_SORDER. SO_PREFIX,

    CO_SORDER. SO_NUMBER,

    CO_ITEM. SHORT_NAME,

    CO_ITEM. NOM_ELEMENT,

    CO_SORDER. SO_SUFFIX,

    CO_SORDER. SO_PREFIX

    || '-'

    || CO_SORDER. SO_NUMBER

    || '-'

    || CO_SORDER. SO_SUFFIX

    AS CONC_SO_NUMBER,

    CO_POSITION. POSITION_NAME,

    CO_POSITION. SPOT_YN,

    qryAllocationsGrouper.SumOfPO_ALLOC_QTY AS bags,

    SumOfQTY_ALLOC * 2204.62 AS Lbs,.

    CO_SORDER. DELVPERIOD_FROM,

    CO_SORDER. DELVPERIOD_TO,

    CO_SORDER. PRICE,

    CO_PORDER. PO_PREFIX

    || '-'

    || CO_PORDER. PO_NUMBER

    || '-'

    || CO_PORDER. PO_SUFFIX

    AS CONC_PO_NUMBER,

    CO_PORDER. PO_NUMBER,

    CO_PORDER. PO_SUFFIX,

    CO_PORDER. PO_PRICE PRICE,

    CO_SORDER. CUSTOMER_CODE,

    CO_CUSTOMER. SHORT_NAME AS CUST_SHORT,

    CO_CUSTOMER. CLIENT_NAME,

    CO_SORDER. ORDER_DATE,

    qryAllocationsGrouper.SO_KEY,

    qryAllocationsGrouper.PO_KEY,

    GN_USERS. SHORT_NAME AS REP,

    CO_SORDER. STATUS

    OF CO_ORIGIN

    JOIN IN-HOUSE (CO_ITEM

    JOIN IN-HOUSE

    (((CO_SORDER

    JOIN INTERNAL CO_CUSTOMER

    ON CO_SORDER. CUSTOMER_CODE =

    CO_CUSTOMER. CUSTOMER_CODE)

    JOIN IN-HOUSE

    (CO_PORDER

    JOIN IN-HOUSE

    (SELECT CO_ALLOCATION_TAIL. PO_KEY,

    CO_ALLOCATION_TAIL. SO_KEY,

    SUM)

    CO_ALLOCATION_TAIL. QTY_ALLOC)

    AS SumOfQTY_ALLOC,

    SUM)

    CO_ALLOCATION_TAIL. PO_ALLOC_QTY)

    AS SumOfPO_ALLOC_QTY,

    MIN)

    CO_ALLOCATION_TAIL. ALLOC_DATE)

    AS MinOfALLOC_DATE,

    MAX)

    CO_ALLOCATION_TAIL. ALLOC_DATE)

    AS MaxOfALLOC_DATE,

    CO_SORDER. STATUS

    OF CO_ALLOCATION_TAIL

    JOIN INTERNAL CO_SORDER

    ON CO_ALLOCATION_TAIL. SO_KEY =

    CO_SORDER. SO_KEY

    GROUP OF CO_ALLOCATION_TAIL. PO_KEY,

    CO_ALLOCATION_TAIL. SO_KEY,

    CO_SORDER. STATUS

    HAVE (((CO_SORDER. STATUS) =

    'O')))

    qryAllocationsGrouper

    ON CO_PORDER. PO_KEY =

    qryAllocationsGrouper.PO_KEY)

    ON CO_SORDER. SO_KEY =

    qryAllocationsGrouper.SO_KEY)

    JOIN INTERNAL GN_USERS

    ON CO_SORDER. ENTERED_USER = GN_USERS. USER_ID)

    JOIN INTERNAL CO_POSITION

    ON CO_SORDER. POSITION =

    CO_POSITION. POSITION_CODE)

    ON CO_ITEM. ITEM_CODE = CO_PORDER. ITEM_CODE)

    ON CO_ORIGIN. ORIGIN_CODE = CO_ITEM. ORIGIN_CODE

    WHERE (((CO_SORDER. (STATUS) = 'O'))

    ORDER OF CO_PORDER. QryAllocations PO_NUMBER DESC)

    LEFT JOIN

    (SELECT qryInvoices.PO_KEY,

    qryInvoices.SO_KEY,

    qryInvoices.SHORT_NAME,

    qryInvoices.CUSTOMER_NAME,

    qryInvoices.CONC_SO_NUMBER,

    qryInvoices.CONC_PO_NUMBER,

    SUM (qryInvoices.DELI_BAGS) AS SumOfDELI_BAGS,

    SUM (qryInvoices.NET_QTY) AS SumOfNET_QTY,

    MIN (qryInvoices.INVOICE_DATE) AS MinOfINVOICE_DATE,

    MAX (qryInvoices.INVOICE_DATE) AS MaxOfINVOICE_DATE

    FROM (SELECT CO_FINAL_INVOICE. INVOICE_NUMBER,

    CO_FINAL_INVOICE. INVOICE_DATE,

    CO_TRF_DELIVERY. DELI_NO,

    CO_TRF_DELIVERY. DELI_DATE,

    CO_PAYTERMS. PAYTERMS_NAME,

    CO_FINAL_INVOICE. END_DATE,

    CO_CUSTOMER. SHORT_NAME,

    CO_CUSTOMER. CLIENT_NAME,

    CO_FINAL_INVOICE. INVOICE_FINAL_AMOUNT,

    CO_FINAL_INVOICE. PAYTERMS_CODE,

    CO_TRF_DELICONTAINER. DELI_BAGS,

    CO_FINAL_INVOICE_DETAIL.NET_QTY,

    CO_FINAL_INVOICE_DETAIL. INV_PRICE,

    CO_SORDER. SO_PREFIX

    || '-'

    || CO_SORDER. SO_NUMBER

    || '-'

    || CO_SORDER. SO_SUFFIX

    AS CONC_SO_NUMBER,

    CO_PORDER. PO_PREFIX

    || '-'

    || CO_PORDER. PO_NUMBER

    || '-'

    || CO_PORDER. PO_SUFFIX

    AS CONC_PO_NUMBER,

    CO_ORIGIN. SHORT_NAME AS ORIGIN,

    CO_ITEM. SHORT_NAME AS ITEM_SHORT,

    CO_ITEM. ITEM_DESCRIPTION,

    CO_PORDER. SPECIFICATIONS,

    CO_TRF_DELIVERY. PAID_BY,

    CO_FINAL_INVOICE_DETAIL. DELI_CODE,

    CO_FINAL_INVOICE_DETAIL.TR_KEY,

    CO_FINAL_INVOICE. INVOICE_KEY,

    CO_TRF_DELIVERY. MDO_KEY,

    CO_PORDER. PO_KEY,

    CO_SORDER. SO_KEY,

    CO_FINAL_INVOICE. CANCELED_YN

    OF (((CO_FINAL_INVOICE

    JOIN INTERNAL CO_FINAL_INVOICE_DETAIL

    ON CO_FINAL_INVOICE. INVOICE_KEY =

    CO_FINAL_INVOICE_DETAIL. INVOICE_KEY)

    JOIN INTERNAL CO_CUSTOMER

    ON CO_FINAL_INVOICE. BUYER_CODE =

    CO_CUSTOMER. CUSTOMER_CODE)

    JOIN INTERNAL CO_TRF_DELIVERY

    ON (CO_FINAL_INVOICE_DETAIL. SO_KEY =

    CO_TRF_DELIVERY. SO_KEY)

    AND (CO_FINAL_INVOICE_DETAIL.TR_KEY =

    CO_TRF_DELIVERY.TR_KEY)

    AND (CO_FINAL_INVOICE_DETAIL. DELI_CODE =

    CO_TRF_DELIVERY. DELI_CODE))

    JOIN INTERNAL CO_SORDER

    ON (CO_CUSTOMER. CUSTOMER_CODE =

    CO_SORDER. CUSTOMER_CODE)

    AND (CO_FINAL_INVOICE_DETAIL. SO_KEY =

    CO_SORDER. SO_KEY))

    JOIN INTERNAL CO_PORDER

    ON CO_TRF_DELIVERY. PO_KEY = CO_PORDER. PO_KEY)

    JOIN INTERNAL CO_PAYTERMS

    ON CO_FINAL_INVOICE. PAYTERMS_CODE =

    CO_PAYTERMS. PAYTERMS_CODE)

    JOIN INTERNAL CO_TRF_DELICONTAINER

    ON CO_TRF_DELIVERY. DELI_CODE =

    CO_TRF_DELICONTAINER. DELI_CODE)

    JOIN IN-HOUSE

    (CO_ORIGIN

    JOIN IN-HOUSE CO_ITEM

    ON CO_ORIGIN. ORIGIN_CODE = CO_ITEM. ORIGIN_CODE)

    ON CO_SORDER. ITEM_CODE = CO_ITEM. ITEM_CODE

    GROUP OF CO_FINAL_INVOICE. INVOICE_NUMBER,

    CO_FINAL_INVOICE. INVOICE_DATE,

    CO_TRF_DELIVERY. DELI_NO,

    CO_TRF_DELIVERY. DELI_DATE,

    CO_PAYTERMS. PAYTERMS_NAME,

    CO_FINAL_INVOICE. END_DATE,

    CO_CUSTOMER. SHORT_NAME,

    CO_CUSTOMER. CLIENT_NAME,

    CO_FINAL_INVOICE. INVOICE_FINAL_AMOUNT,

    CO_FINAL_INVOICE. PAYTERMS_CODE,

    CO_TRF_DELICONTAINER. DELI_BAGS,

    CO_FINAL_INVOICE_DETAIL.NET_QTY,

    CO_FINAL_INVOICE_DETAIL. INV_PRICE,

    CO_SORDER. SO_PREFIX

    || '-'

    || CO_SORDER. SO_NUMBER

    || '-'

    || CO_SORDER. SO_SUFFIX,

    CO_PORDER. PO_PREFIX

    || '-'

    || CO_PORDER. PO_NUMBER

    || '-'

    || CO_PORDER. PO_SUFFIX,

    CO_ORIGIN. SHORT_NAME,

    CO_ITEM. SHORT_NAME,

    CO_ITEM. ITEM_DESCRIPTION,

    CO_PORDER. SPECIFICATIONS,

    CO_TRF_DELIVERY. PAID_BY,

    CO_FINAL_INVOICE_DETAIL. DELI_CODE,

    CO_FINAL_INVOICE_DETAIL.TR_KEY,

    CO_FINAL_INVOICE. INVOICE_KEY,

    CO_TRF_DELIVERY. MDO_KEY,

    CO_PORDER. PO_KEY,

    CO_SORDER. SO_KEY,

    CO_FINAL_INVOICE. CANCELED_YN

    HAVE (((CO_FINAL_INVOICE. CANCELED_YN) IS NOTHING))

    ORDER OF CO_FINAL_INVOICE. QryInvoices INVOICE_NUMBER DESC)

    QryInvoices.PO_KEY GROUP,

    qryInvoices.SO_KEY,

    qryInvoices.SHORT_NAME,

    qryInvoices.CUSTOMER_NAME,

    qryInvoices.CONC_SO_NUMBER,

    qryInvoicesSumBySO of qryInvoices.CONC_PO_NUMBER)

    WE (qryAllocations.PO_KEY = qryInvoicesSumBySO.PO_KEY)

    AND (qryAllocations.SO_KEY = qryInvoicesSumBySO.SO_KEY)

    ORDER BY qryAllocations.DELVPERIOD_TO;

    See you soon,.

    Manik.

  • keyword not found where expected

    Hello
    I have this query that I'm get keyword not found where expected

               
               select sum_view.transport, formula_view.transport_formula, sum_view.sload, formula_view.sload_formula, sum_view.opn_job_desc,sum_view.OPN_VALUE
    from
    (
    select 
    (
    SUM(case when F.ITEM_UOM = 'Cubic Feet' then
           (case when upper(substr(H.SLURRY_TYPE,1,3)) <> upper('Top') then ROUND(((H.SLURRY_VOL_ACTUAL * 5.6146)/H.SLURRY_YIELD))
                 else 0 end)
            else 0 end)
       +
    SUM(case when F.ITEM_UOM = 'Cubic Feet' then
           (case when upper(substr(H.SLURRY_TYPE,1,3)) = upper('Top') then nvl(H.CLASS_V_CEMENT,0)
                 else 0 end)
             else 0 end)
                   )*(0.047) +
    SUM(case when F.ITEM_UOM =  'Pound' then
               Ceil((ROUND(((H.SLURRY_VOL_ACTUAL * 5.6146)/DECODE(H.SLURRY_YIELD,0,NULL,H.SLURRY_YIELD)))*94)*F.ITEM_PERCENT/100 )ELSE 0 end)*0.0005
    )*(j.opn_value/2)transport,
            SUM(case when F.ITEM_UOM = 'Cubic Feet' then
                ROUND(((H.SLURRY_VOL_ACTUAL * 5.6146)/H.SLURRY_YIELD))end)sload ,
          e.opn_job_desc,J.OPN_VALUE---e.invoice_ref,e.invoice_ref_m,f.item_number,f.item_name,f.item_uom,f.description,J.OPN_VALUE
         FROM xxnp_opn_joblog_001 E,
              XXNP_OPN_JOBLOG_EST_002   F,
              XXNP_OPN_JOBLOG_STAGE_002 G,
              XXNP_OPN_JOBLOG_SLURRY_003 H,
        XXNP_OPN_JOBLOG_RES_005 J
          WHERE E.OPN_JOB_DESC   = E.OPN_JOB_DESC AND E.MANUAL='N'
       and J.opn_resource_desc='4X4  PICK-UP OR LIGHT VEHICLES'
        AND E.OPN_JOBLOG_001_ID = J.OPN_JOBLOG_001_ID 
          AND E.OPN_JOBLOG_001_ID = G.OPN_JOBLOG_001_ID
            AND G.OPN_JOBLOG_006_ID = H.OPN_JOBLOG_006_ID
            AND H.OPN_JOBLOG_007_ID = F.OPN_JOBLOG_007_ID
            AND G.OPN_JOBLOG_006_ID = H.OPN_JOBLOG_006_ID
            AND H.OPN_JOBLOG_007_ID = F.OPN_JOBLOG_007_ID group by e.opn_job_desc,J.OPN_VALUE
    ) sum_view,
    (
    SELECT
       
       opn_value,opn_job_desc,
       
       '(('
       ||DECODE(cubic_feet_no_top_formula, NULL, NULL, 'SUM('||cubic_feet_no_top_formula||')')
       ||DECODE(cubic_feet_top_formula, NULL, NULL, '+SUM('||cubic_feet_top_formula||')')||'*0.047+)'
       ||DECODE(pound_formula, NULL, NULL, 'SUM('||pound_formula||')')||'*0.0005'
       ||')' 
       ||'*('
       ||opn_value
       ||'/2)' transport_formula,
       DECODE(cubic_feet_no_top_formula, NULL, NULL, 'SUM('||cubic_feet_no_top_formula||')')  
       ||DECODE(cubic_feet_top_formula, NULL, NULL, '+SUM('||cubic_feet_top_formula||')') sload_formula    
    FROM
    (
    SELECT DISTINCT a.opn_value,a.opn_job_desc
              ,rowtocol('SELECT formula FROM test23 WHERE opn_value = ' || '''' || a.opn_value || '''' || ' AND top_yes_no = ' || '''' || 'N' || '''' || ' AND opn_job_desc = ' || '''' || a.opn_job_desc || '''' ||' AND item_uom IN ('''||'Cubic Feet'''||')',' + ')
              AS cubic_feet_no_top_formula
              ,rowtocol('SELECT formula FROM test23 WHERE opn_value = ' || '''' || a.opn_value || '''' || ' AND top_yes_no = ' || '''' || 'Y' || '''' || ' AND opn_job_desc = ' || '''' || a.opn_job_desc || '''' ||' AND item_uom IN ('''||'Cubic Feet'''||')',' + ')
              AS cubic_feet_top_formula
               ,rowtocol('SELECT formula FROM test23 WHERE opn_value = ' || '''' || a.opn_value ||  '''' || ' AND opn_job_desc = ' || '''' || a.opn_job_desc || '''' ||' AND item_uom IN ('''||'Pound'''||')',' + ')
               AS pound_formula
               ,rowtocol('SELECT formula FROM test23 WHERE opn_value = ' || '''' || a.opn_value ||  '''' || ' AND opn_job_desc = ' || '''' || a.opn_job_desc || '''' ||' AND item_uom IN ('''||'Gallon'''||')',' + ')
               AS gallon_formula          
       FROM test23 a
    )
    ) formula_view
    where 1=1
    and  sum_view.opn_value = formula_view.opn_value
    and sum_view.opn_job_desc=formula_view.opn_job_desc;
    kindly help me
    thanking in advance

    I found 2 things:

    first of all, this

    when upper(substr(H.SLURRY_TYPE,1,3))  upper('Top')
    

    should be present

    when upper(substr(H.SLURRY_TYPE,1,3))  = upper('Top')
    

    and second, there is a support missing on the third line;

    select sum_view.transport, formula_view.transport_formula, sum_view.sload, formula_view.sload_formula, sum_view.opn_job_desc,sum_view.OPN_VALUE
    from (
          ( -- this needs to be added in
          select (
                   sum
                      (
                       case when F.ITEM_UOM = 'Cubic Feet' then
                        (case when upper(substr(H.SLURRY_TYPE,1,3)) = 'TOP' then
                           round (
                                  ( (H.SLURRY_VOL_ACTUAL * 5.6146)/H.SLURRY_YIELD )
                                 )
                         else
                           0
                         end
                        )
                      else 0 end
                      )
                +
                   sum
                     (
                      case when F.ITEM_UOM = 'Cubic Feet' then
                       (case when upper(substr(H.SLURRY_TYPE,1,3)) = 'TOP' then
                          nvl(H.CLASS_V_CEMENT,0)
                         else
                          0
                        end
                       )
                      else 0
                      end
                     )
                 )
                   * (0.047)
          +
          sum
              (
               case when F.ITEM_UOM =  'Pound' then
                 ceil (
                        (round
                           (
                             (
                               (H.SLURRY_VOL_ACTUAL * 5.6146)/decode(H.SLURRY_YIELD,0,null,H.SLURRY_YIELD)
                             )
                           ) * 94
                        ) *F.ITEM_PERCENT/100
                      )
               else 0 end
              ) * 0.0005
         ) *
         (j.opn_value/2) as Transport
        ,
         sum(case when F.ITEM_UOM = 'Cubic Feet' then
                round(((H.SLURRY_VOL_ACTUAL * 5.6146)/H.SLURRY_YIELD))
             end
            ) as sload
         ,e.opn_job_desc
         ,J.OPN_VALUE
    from  xxnp_opn_joblog_001        E,
          XXNP_OPN_JOBLOG_EST_002    F,
          XXNP_OPN_JOBLOG_STAGE_002  G,
          XXNP_OPN_JOBLOG_SLURRY_003 H,
          XXNP_OPN_JOBLOG_RES_005    J
    where E.OPN_JOB_DESC = E.OPN_JOB_DESC
    and   E.MANUAL ='N'
    and   J.opn_resource_desc='4X4  PICK-UP OR LIGHT VEHICLES'
    and   E.OPN_JOBLOG_001_ID = J.OPN_JOBLOG_001_ID
    and   E.OPN_JOBLOG_001_ID = G.OPN_JOBLOG_001_ID
    and   G.OPN_JOBLOG_006_ID = H.OPN_JOBLOG_006_ID
    and   H.OPN_JOBLOG_007_ID = F.OPN_JOBLOG_007_ID
    and   G.OPN_JOBLOG_006_ID = H.OPN_JOBLOG_006_ID
    and   H.OPN_JOBLOG_007_ID = F.OPN_JOBLOG_007_ID
    group by e.opn_job_desc
            ,J.OPN_VALUE
    ) sum_view,
    

    P;

  • Merger clause retrieves ORA-00923 FROM keyword not found where expected

    Hello world

    I want to be able to update/insert records using the MERGE clause of each
    15 minutes, so I probe every segment of this code and its work, in
    fact the segment with the FUSION works perfect replacement the
    the variables vPMM_DATETIME and vEND_DATETIME for constants, but (and his)
    crazy me!) When I probe this huge query, I get the error:


    Error: ORA-00923: KEYWORD not found where expected
    ORA-06512: at line 63, batch 1 row 1, Col 1


    Line 63 is the MERGER IN OM_DB. CDRS_VALIDOS 'X', so what is
    happening? because each segment of code works if I have one tube
    one!, please help!
    DECLARE
        vPMM_DATETIME        TIMESTAMP(3);
        vMAX_PMM_DATETIME    TIMESTAMP(3);
        vEND_DATETIME        TIMESTAMP(3);
        v_rows_processed     INT;
        count_violated       INT;
    BEGIN
        dbms_output.enable(40000);
        dbms_output.put_line('Inicio de procedimiento: ' || TO_CHAR(sysdate, 'YYYY-MM-DD HH24:MI:SS'));
        
        -- Valida si existe informacion en la tabla de origen
        -- *****************************************************************************
        count_violated := 0;
        SELECT COUNT(START_TIME) INTO count_violated FROM OM_DB.CDRS_PRUEBA;
        IF (count_violated=0) THEN
            dbms_output.put_line('No hay informacion en la tabla de origen');
        ELSE
            SELECT TO_DATE(TO_CHAR(MIN(START_TIME),'YYYY-MM-DD HH24') || ':00:00','YYYY-MM-DD HH24:MI:SS') 
            INTO   vPMM_DATETIME 
            FROM   OM_DB.CDRS_PRUEBA;
    
            vEND_DATETIME := vPMM_DATETIME + 1/24;
    
            SELECT TO_DATE(TO_CHAR(MAX(START_TIME),'YYYY-MM-DD HH24') || ':59:59','YYYY-MM-DD HH24:MI:SS')
            INTO   vMAX_PMM_DATETIME 
            FROM   om_db.CDRS_PRUEBA;
    
            WHILE (vPMM_DATETIME <= vMAX_PMM_DATETIME) LOOP
                MERGE INTO OM_DB.CDRS_VALIDOS "X"
                USING (
                    SELECT 
                        DISTINCT(ESTADO) AS "ESTADO",
                        MUNICIPIO,
                        CALL_SOURCE_REGID,
                        SUM(EXITOSOS) AS "EXITOSOS",
                        SUM(NO_EXITOSOS) AS "NO_EXITOSOS",
                        SUM(NO_CONECT) AS "NO_CONECT",
                        PMM_DATETIME
                    FROM ( 
                        SELECT 
                            COALESCE(V_EXITOSOS.ESTADO, V_NO_EXITOSOS.ESTADO, V_NO_CONECT.ESTADO) AS "ESTADO",
                            COALESCE(V_EXITOSOS.MUNICIPIO, V_NO_EXITOSOS.MUNICIPIO, V_NO_CONECT.MUNICIPIO) AS "MUNICIPIO",
                            COALESCE(V_EXITOSOS.CALL_SOURCE_REGID, V_NO_EXITOSOS.CALL_SOURCE_REGID, V_NO_CONECT.CALL_SOURCE_REGID) AS "CALL_SOURCE_REGID",
                            COALESCE(V_EXITOSOS.EXITOSOS,0) AS "EXITOSOS",
                            COALESCE(V_NO_EXITOSOS.NO_EXITOSOS,0) AS "NO_EXITOSOS",
                            COALESCE(V_NO_CONECT.NO_CONECT,0) AS "NO_CONECT",
                            '2009-03-17 17:00:00' AS "PMM_DATETIME"
                        FROM 
                        (
                            SELECT 
                                DISTINCT(ESTADO) AS "ESTADO",
                                MUNICIPIO,
                                CALL_SOURCE_REGID,
                                COUNT(CALL_SOURCE_REGID) AS "EXITOSOS"
                            FROM (
                                SELECT 
                                    A.CALL_SOURCE_REGID,
                                    B.ESTADO,
                                    B.MUNICIPIO
                                FROM   OM_DB.CDRS_PRUEBA A, OM_DB.COFETEL B
                                WHERE  A.START_TIME BETWEEN vPMM_DATETIME AND vEND_DATETIME
                                AND    TO_NUMBER(A.CALLED_PARTY_ON_DEST_PART3) between B.NIR_INICIAL AND B.NIR_FINAL
                                AND    A.CALL_DURATION_INT >= 5
                                AND    B.MODALIDAD IN ('CPP','FIJO','MPP')
                            ) 
                            GROUP BY 
                                ESTADO,
                                MUNICIPIO,
                                CALL_SOURCE_REGID
                        ) "V_EXITOSOS"
                        FULL OUTER JOIN  
                        (
                            SELECT 
                                DISTINCT(ESTADO) AS "ESTADO",
                                MUNICIPIO,
                                CALL_SOURCE_REGID,
                                COUNT(CALL_SOURCE_REGID) AS "NO_EXITOSOS"
                            FROM (
                                SELECT 
                                    C.CALL_SOURCE_REGID, 
                                    D.ESTADO,
                                    D.MUNICIPIO
                                FROM   OM_DB.CDRS_PRUEBA C, OM_DB.COFETEL D
                                WHERE  C.START_TIME BETWEEN vPMM_DATETIME AND vEND_DATETIME
                                AND    TO_NUMBER(C.CALLED_PARTY_ON_DEST_PART3) between D.NIR_INICIAL AND D.NIR_FINAL
                                AND    C.CALL_DURATION_INT >= 1 AND C.CALL_DURATION_INT < 5
                                AND    D.MODALIDAD IN ('CPP','FIJO','MPP')
                            ) 
                            GROUP BY 
                                ESTADO,
                                MUNICIPIO,
                                CALL_SOURCE_REGID
                        ) "V_NO_EXITOSOS"
                        ON
                            V_EXITOSOS.ESTADO = V_NO_EXITOSOS.ESTADO
                            AND V_EXITOSOS.MUNICIPIO = V_NO_EXITOSOS.MUNICIPIO
                            AND V_EXITOSOS.CALL_SOURCE_REGID = V_NO_EXITOSOS.CALL_SOURCE_REGID
                        FULL OUTER JOIN
                        (
                            SELECT 
                                DISTINCT(ESTADO) AS "ESTADO",
                                MUNICIPIO,
                                CALL_SOURCE_REGID,
                                COUNT(CALL_SOURCE_REGID) AS "NO_CONECT"
                            FROM (
                                SELECT 
                                    C.CALL_SOURCE_REGID, 
                                    D.ESTADO,
                                    D.MUNICIPIO
                                FROM   OM_DB.CDRS_PRUEBA C, OM_DB.COFETEL D
                                WHERE  C.START_TIME BETWEEN vPMM_DATETIME AND vEND_DATETIME
                                AND    TO_NUMBER(C.CALLED_PARTY_ON_DEST_PART3) between D.NIR_INICIAL AND D.NIR_FINAL
                                AND    C.CALL_DURATION_INT = 0
                                AND    D.MODALIDAD IN ('CPP','FIJO','MPP')
                            ) 
                            GROUP BY 
                                ESTADO,
                                MUNICIPIO,
                                CALL_SOURCE_REGID
                        ) "V_NO_CONECT"
                        ON
                            V_NO_CONECT.ESTADO = V_EXITOSOS.ESTADO
                            AND V_NO_CONECT.MUNICIPIO = V_EXITOSOS.MUNICIPIO
                            AND V_NO_CONECT.CALL_SOURCE_REGID = V_EXITOSOS.CALL_SOURCE_REGID
                    )
                    GROUP BY
                        PMM_DATETIME,
                        CALL_SOURCE_REGID,
                        ESTADO,
                        MUNICIPIO
                ) "Y" -- Cierra USING
                ON (
                    X.PMM_DATETIME          = Y.PMM_DATETIME
                    AND X.CALL_SOURCE_REGID = Y.CALL_SOURCE_REGID
                    AND X.ESTADO            = Y.ESTADO
                    AND X.MUNICIPIO         = Y.MUNICIPIO
                )
                WHEN MATCHED THEN UPDATE SET 
                    X.EXITOSOS    = X.EXITOSOS    + Y.EXITOSOS,
                    X.NO_EXITOSOS = X.NO_EXITOSOS + Y.NO_EXITOSOS,
                    X.NO_CONECT   = X.NO_CONECT   + Y.NO_CONECT
                WHEN NOT MATCHED THEN INSERT (X.ESTADO, X.MUNICIPIO, X.CALL_SOURCE_REGID, X.EXITOSOS, X.NO_EXITOSOS, X.NO_CONECT, X.PMM_DATETIME)
                    VALUES (Y.ESTADO, Y.MUNICIPIO, Y.CALL_SOURCE_REGID, Y.EXITOSOS, Y.NO_EXITOSOS, Y.NO_CONECT, Y.PMM_DATETIME);
                
                vPMM_DATETIME := vPMM_DATETIME + 1/24;
                vEND_DATETIME := vPMM_DATETIME + 1/24;
            END LOOP;
            COMMIT;
        END IF;
        
        dbms_output.put_line('Fin de procedimiento: ' || TO_CHAR(sysdate, 'YYYY-MM-DD HH24:MI:SS'));
    END;
    Published by: user6754713 on 22-Apr-2009 12:31

    The role of labour said in my previous post:

    perform merge every 15 minutes every day?

    You want to run your merge every 15 minutes a day or?

  • 2.1 EA 1: ORA-00923: KEYWORD not found where expected

    Hello

    There is a simple table that is causing this error when opening the data tab. All the other tabs are ok. 1.5 the table can be opened with the data tab.

    Columns:

    ID NUMBER no 1
    PARENT_ID Yes NUMBER 2
    Node_name VARCHAR2 (50 BYTE) Yes 3
    KREDFILIALE VARCHAR2 (50 BYTE) Yes 4
    DATE of VALID_FROM Yes to_date('20081001','yyyymmdd') 5
    DATE of VALID_TO Yes to_date('20090930','yyyymmdd') 6
    Yes NUMBER (2.0) LEVEL 7
    LIEFERANTENNR VARCHAR2 (50 BYTE) Yes 8
    SCGROUP Yes NUMBER 9

    Kind regards

    Jürgen

    Bug 9000729 - ea1 connected: otnforum: datatab opens for a reserved keyword column name
    -Rambeau

  • Listagg function displays the keyword not found error message

    is version of Oracle 11 g
    create or replace
    function fn_months_attended
    return number is
    v_array varchar2(1000);
    begin
      select LISTAGG(c.act_id,',') within group (order by c.act_id desc) INTO V_ARRAY from 
              programmes a,campaigns b,activities c
            where  a.pro_id=b.cam_pro_id 
            and    b.cam_id=c.act_act_id 
            order by act_id DESC ;
    return v_array;
    end;
    
    Error i received 
    Error(6,3): PL/SQL: SQL Statement ignored
    Error(6,39): PL/SQL: ORA-00923: FROM keyword not found where expected
    can you please suggest me to find exactly the problem

    Hello

    In the LIST of 11 GR 1 tot material. function does not work. It works in only 11 GR 2.

    Kind regards
    Champion.

  • Member not found when loading data with SQL

    Hello everyone:

    I created a cube map extract all information with SQL statements and it works perfectly. Now I'm trying to load data in the same way, but I can't.

    I created a view that returns data in this format:

    Dimension 1 < tab > axis 2 < tab > member... Member of dimension 5 < tab > measure 1 < tab > 2 < tab > measure 3

    I designed a new rule, indicating for each column in the dimension; and for each measure which specific member of dimension of accounts must be used. I have check and everything is ok, but when I try to load data, it does not work and tells me error:

    + "Data value [3.5] met before that all the selected Dimensions, [1] Records duly filled.
    + Essbase error unexpected 1003007 "+"

    If I get the names of the members with quotes (because they contain spaces, and it is perhaps the reason for the previous error, although the rule analysis correctly) with the SQL statement, when Essbase import, it deletes these quotes. I must use another symbol, and as a rule change this another symbol quotes. Is this normal? I know that this issue when importing formulas, but not here.

    Why in 'Dimension building' I don't have this problem with quotes?

    And when changing the symbols of quotes, this error occurs:

    + "Member x not found in the database" +. " But I check the Member and there are in general terms. What's wrong with that? »


    Thanks in advance

    Concerning

    Javier

    Published by: Javi M on 26-mar-2011 05:52

    Yes, the SQL files and data (of all kinds) are supported by more than one column of data. As you noted, you just point to the Member that represents the column.

    That said, I bet that if you look at your view/table and load the rule against your outline, I bet you find a dimension be mismapped, for example, you think that this column 4 points to the scenario, but you really repointe it produces and which purported to be the column 1, or you missed a dimension. Happens to me all the time.

    Kind regards

    Cameron Lackpour

  • get a mistake-keyword not found if necessary.

    Please reaply ASAP!

    What is the problem with the query?

    SELECT
    AAA.user_id
    AAA. ISpeak,
    SUM (ROUND (AAA. ADURATION_SECONDS/DECODE(AAA.) ISPEAK, 0, OFFPEAKPULSE, PEAKPULSE)) * DECODE(ISPEAK,0,OFFPEAKPULSE,PEAKPULSE)) DURATION.
    SRT. Circle,
    SRT.package_id,
    SRT.peak_rate,
    SRT.offpeak_rate,
    SRT.bst_plantype,
    SRT.free_value,
    SRT.peak_pulse,
    SRT.offpeak_pulse,
    SRT.pulse_unit,
    SRT.rating_unit
    To aaa, subscriber_rate_tab srt aaa_sessions
    WHERE aaa.user_id = srt.externalid (+)
    AND (aaa.start_time_utc between srt.activedt and srt.inactivedt)
    AND (aaa.end_time_utc between srt.activedt and srt.inactivedt);

    Where is the comma in the first line? Use aaa.user_id. So tell us what is the following error that appeal to you!

  • BlackBerry ALERTS EMAIL &amp; SMS ENTRANTS smartphones &gt; can NOT FIND WHERE to CHANGE THE TONES only

    SkyScout come back for the 2nd issue since upgrade to the 9000 "BOLD" to a version of impeller 8000 series:

    I transferred my CONTACTS and other PARAMETERS of my 8000 series BB successfully using the SOFTWARE of OFFICE of BB.

    With the new sounds available, I would like to change the ALERT TONE I had used on my BB 8000 for a new, different on BB 9000.

    How can I do this?

    I went in profiles > ADVANCED > NORMAL... where it displays:

    BlackBerry Messenger alert

    New Message from blackBerry Messenger

    Browsers

    Calendar

    Level 1

    etc...

    I have modifed the TONES for CASE in and out of the HOLSTER on the first two.

    However, the TONES for the arrival of email and SMS remains the same since my 8000 series!

    Help!

    Where can I find the TONE changes for my e-mail and SMS?

    Your help would be most appreciated.

    SkyScout... w / less than 16 hours old 9000

    DISCOVERY SOLUTION!

    Well, I just found the solution myself. FOR FUTURE REFERENCE, I note the following:

    In my first post above I wrote:

    have been in the School Board Profiles > ADVANCED > NORMAL... where it displays:

    BlackBerry Messenger alert

    New Message from blackBerry Messenger

    Browsers

    Calendar

    Level 1

    etc...

    I didn't continue on in the list.

    Here's 'Level 1' separate for lines:

    Messages: [[email protected]]

    Messages: [[email protected]]

    By selecting each one, then opening them (by clicking the joystick) - a separate menu returns to each of them.  THAT I discovered at the time of my JOY and AMAZEMENT, it's I can create separate TONES for every different email through this!

    Nevertheless, I thank those of you who have or hereinafter strives to have helped on this solution!

    Thank you!

  • AppleSyncNotifier.exe - cannot find component__Corefoundation.dll can not be found. where can I get these from?

    AppleSyncNotifier.exe - Unable to locate component

    Corefoundation.dll was not found where can I buy from?

    Hello

    Try the steps by Lorien - One (Monday, 9 August 2010 18:07) the link below and check if that helps.
    http://social.answers.Microsoft.com/forums/en-us/vistaprograms/thread/e69def34-439D-4C4A-83da-4e3770fedf8f

    Thanks and greetings
    Umesh P - Microsoft technical support.

    Visit our Microsoft answers feedback Forum and let us know what you think.
    [If this post can help solve your problem, please click the 'Mark as answer' or 'Useful' at the top of this message.] [Marking a post as answer, or relatively useful, you help others find the answer more quickly.]

  • getExpressionObjectReference "method not found".

    Hello! I use the method:
      public void PasesPPR(ValueChangeEvent valueChangeEvent) {
        GenericButton gB = (GenericButton)JsfUtils.getExpressionObjectReference("#{GenericButton}");
        gB.getThirdLevel().setDisabled(true);
        AdfFacesContext.getCurrentInstance().addPartialTarget(gB.getThirdLevel());
        
      }
    And I have error: getExpressionObjectReference method not found

    Where would be the problem?

    Best regards, Debuger!

    Doggone it, OTN.

    Here is the code

    package oracle.fodemo.storefront.jsf.util;
    
    import java.util.Iterator;
    import java.util.Locale;
    import java.util.Map;
    import java.util.MissingResourceException;
    import java.util.ResourceBundle;
    
    import javax.el.ELContext;
    import javax.el.ExpressionFactory;
    
    import javax.el.MethodExpression;
    import javax.el.ValueExpression;
    
    import javax.faces.application.Application;
    import javax.faces.application.FacesMessage;
    import javax.faces.component.UIComponent;
    import javax.faces.component.UIViewRoot;
    import javax.faces.context.ExternalContext;
    import javax.faces.context.FacesContext;
    
    import javax.servlet.http.HttpServletRequest;
    
    /**
     * General useful static utilies for working with JSF.
     * NOTE: Updated to use JSF 1.2 ExpressionFactory.
     *
     * @author Duncan Mills
     * @author Steve Muench
     *
     * $Id: JSFUtils.java 1885 2007-06-26 00:47:41Z ralsmith $
     */
    public class JSFUtils {
    
        private static final String NO_RESOURCE_FOUND = "Missing resource: ";
    
        /**
         * Method for taking a reference to a JSF binding expression and returning
         * the matching object (or creating it).
         * @param expression EL expression
         * @return Managed object
         */
        public static Object resolveExpression(String expression) {
            FacesContext facesContext = getFacesContext();
            Application app = facesContext.getApplication();
            ExpressionFactory elFactory = app.getExpressionFactory();
            ELContext elContext = facesContext.getELContext();
            ValueExpression valueExp =
                elFactory.createValueExpression(elContext, expression,
                                                Object.class);
            return valueExp.getValue(elContext);
        }
    
        /**
         * @return
         */
        public static String resolveRemoteUser() {
            FacesContext facesContext = getFacesContext();
            ExternalContext ectx = facesContext.getExternalContext();
            return ectx.getRemoteUser();
        }
    
        /**
         * @return
         */
        public static String resolveUserPrincipal() {
            FacesContext facesContext = getFacesContext();
            ExternalContext ectx = facesContext.getExternalContext();
            HttpServletRequest request = (HttpServletRequest)ectx.getRequest();
            return request.getUserPrincipal().getName();
        }
    
        /**
         * @param expression
         * @param returnType
         * @param argTypes
         * @param argValues
         * @return
         */
        public static Object resolveMethodExpression(String expression,
                                                     Class returnType,
                                                     Class[] argTypes,
                                                     Object[] argValues) {
            FacesContext facesContext = getFacesContext();
            Application app = facesContext.getApplication();
            ExpressionFactory elFactory = app.getExpressionFactory();
            ELContext elContext = facesContext.getELContext();
            MethodExpression methodExpression =
                elFactory.createMethodExpression(elContext, expression, returnType,
                                                 argTypes);
            return methodExpression.invoke(elContext, argValues);
        }
    
        /**
         * Method for taking a reference to a JSF binding expression and returning
         * the matching Boolean.
         * @param expression EL expression
         * @return Managed object
         */
        public static Boolean resolveExpressionAsBoolean(String expression) {
            return (Boolean)resolveExpression(expression);
        }
    
        /**
         * Method for taking a reference to a JSF binding expression and returning
         * the matching String (or creating it).
         * @param expression EL expression
         * @return Managed object
         */
        public static String resolveExpressionAsString(String expression) {
            return (String)resolveExpression(expression);
        }
    
        /**
         * Convenience method for resolving a reference to a managed bean by name
         * rather than by expression.
         * @param beanName name of managed bean
         * @return Managed object
         */
        public static Object getManagedBeanValue(String beanName) {
            StringBuffer buff = new StringBuffer("#{");
            buff.append(beanName);
            buff.append("}");
            return resolveExpression(buff.toString());
        }
    
        /**
         * Method for setting a new object into a JSF managed bean
         * Note: will fail silently if the supplied object does
         * not match the type of the managed bean.
         * @param expression EL expression
         * @param newValue new value to set
         */
        public static void setExpressionValue(String expression, Object newValue) {
            FacesContext facesContext = getFacesContext();
            Application app = facesContext.getApplication();
            ExpressionFactory elFactory = app.getExpressionFactory();
            ELContext elContext = facesContext.getELContext();
            ValueExpression valueExp =
                elFactory.createValueExpression(elContext, expression,
                                                Object.class);
    
            //Check that the input newValue can be cast to the property type
            //expected by the managed bean.
            //If the managed Bean expects a primitive we rely on Auto-Unboxing
            Class bindClass = valueExp.getType(elContext);
            if (bindClass.isPrimitive() || bindClass.isInstance(newValue)) {
                valueExp.setValue(elContext, newValue);
            }
        }
    
        /**
         * Convenience method for setting the value of a managed bean by name
         * rather than by expression.
         * @param beanName name of managed bean
         * @param newValue new value to set
         */
        public static void setManagedBeanValue(String beanName, Object newValue) {
            StringBuffer buff = new StringBuffer("#{");
            buff.append(beanName);
            buff.append("}");
            setExpressionValue(buff.toString(), newValue);
        }
    
        /**
         * Convenience method for setting Session variables.
         * @param key object key
         * @param object value to store
         */
        public static
    
        void storeOnSession(String key, Object object) {
            FacesContext ctx = getFacesContext();
            Map sessionState = ctx.getExternalContext().getSessionMap();
            sessionState.put(key, object);
        }
    
        /**
         * Convenience method for getting Session variables.
         * @param key object key
         * @return session object for key
         */
        public static Object getFromSession(String key) {
            FacesContext ctx = getFacesContext();
            Map sessionState = ctx.getExternalContext().getSessionMap();
            return sessionState.get(key);
        }
    
        /**
         * @param key
         * @return
         */
        public static String getFromHeader(String key) {
            FacesContext ctx = getFacesContext();
            ExternalContext ectx = ctx.getExternalContext();
            return ectx.getRequestHeaderMap().get(key);
        }
    
        /**
         * Convenience method for getting Request variables.
         * @param key object key
         * @return session object for key
         */
        public static Object getFromRequest(String key) {
            FacesContext ctx = getFacesContext();
            Map sessionState = ctx.getExternalContext().getRequestMap();
            return sessionState.get(key);
        }
    
        /**
         * Pulls a String resource from the property bundle that
         * is defined under the application <message-bundle> element in
         * the faces config. Respects Locale
         * @param key string message key
         * @return Resource value or placeholder error String
         */
        public static String getStringFromBundle(String key) {
            ResourceBundle bundle = getBundle();
            return getStringSafely(bundle, key, null);
        }
    
        /**
         * Convenience method to construct a FacesMesssage
         * from a defined error key and severity
         * This assumes that the error keys follow the convention of
         * using _detail for the detailed part of the
         * message, otherwise the main message is returned for the
         * detail as well.
         * @param key for the error message in the resource bundle
         * @param severity severity of message
         * @return Faces Message object
         */
        public static FacesMessage getMessageFromBundle(String key,
                                                        FacesMessage.Severity severity) {
            ResourceBundle bundle = getBundle();
            String summary = getStringSafely(bundle, key, null);
            String detail = getStringSafely(bundle, key + "_detail", summary);
            FacesMessage message = new FacesMessage(summary, detail);
            message.setSeverity(severity);
            return message;
        }
    
        /**
         * Add JSF info message.
         * @param msg info message string
         */
        public static void addFacesInformationMessage(String msg) {
            FacesContext ctx = getFacesContext();
            FacesMessage fm =
                new FacesMessage(FacesMessage.SEVERITY_INFO, msg, "");
            ctx.addMessage(getRootViewComponentId(), fm);
        }
    
        /**
         * Add JSF error message.
         * @param msg error message string
         */
        public static void addFacesErrorMessage(String msg) {
            FacesContext ctx = getFacesContext();
            FacesMessage fm =
                new FacesMessage(FacesMessage.SEVERITY_ERROR, msg, "");
            ctx.addMessage(getRootViewComponentId(), fm);
        }
    
        /**
         * Add JSF error message for a specific attribute.
         * @param attrName name of attribute
         * @param msg error message string
         */
        public static void addFacesErrorMessage(String attrName, String msg) {
            FacesContext ctx = getFacesContext();
            FacesMessage fm =
                new FacesMessage(FacesMessage.SEVERITY_ERROR, attrName, msg);
            ctx.addMessage(getRootViewComponentId(), fm);
        }
    
        // Informational getters
    
        /**
         * Get view id of the view root.
         * @return view id of the view root
         */
        public static String getRootViewId() {
            return getFacesContext().getViewRoot().getViewId();
        }
    
        /**
         * Get component id of the view root.
         * @return component id of the view root
         */
        public static String getRootViewComponentId() {
            return getFacesContext().getViewRoot().getId();
        }
    
        /**
         * Get FacesContext.
         * @return FacesContext
         */
        public static FacesContext getFacesContext() {
            return FacesContext.getCurrentInstance();
        }
        /*
       * Internal method to pull out the correct local
       * message bundle
       */
    
        private static ResourceBundle getBundle() {
            FacesContext ctx = getFacesContext();
            UIViewRoot uiRoot = ctx.getViewRoot();
            Locale locale = uiRoot.getLocale();
            ClassLoader ldr = Thread.currentThread().getContextClassLoader();
            return ResourceBundle.getBundle(ctx.getApplication().getMessageBundle(),
                                            locale, ldr);
        }
    
        /**
         * Get an HTTP Request attribute.
         * @param name attribute name
         * @return attribute value
         */
        public static Object getRequestAttribute(String name) {
            return getFacesContext().getExternalContext().getRequestMap().get(name);
        }
    
        /**
         * Set an HTTP Request attribute.
         * @param name attribute name
         * @param value attribute value
         */
        public static void setRequestAttribute(String name, Object value) {
            getFacesContext().getExternalContext().getRequestMap().put(name,
                                                                       value);
        }
    
        /*
       * Internal method to proxy for resource keys that don't exist
       */
    
        private static String getStringSafely(ResourceBundle bundle, String key,
                                              String defaultValue) {
            String resource = null;
            try {
                resource = bundle.getString(key);
            } catch (MissingResourceException mrex) {
                if (defaultValue != null) {
                    resource = defaultValue;
                } else {
                    resource = NO_RESOURCE_FOUND + key;
                }
            }
            return resource;
        }
    
        /**
         * Locate an UIComponent in view root with its component id. Use a recursive way to achieve this.
         * @param id UIComponent id
         * @return UIComponent object
         */
        public static UIComponent findComponentInRoot(String id) {
            UIComponent component = null;
            FacesContext facesContext = FacesContext.getCurrentInstance();
            if (facesContext != null) {
                UIComponent root = facesContext.getViewRoot();
                component = findComponent(root, id);
            }
            return component;
        }
    
        /**
         * Locate an UIComponent from its root component.
         * Taken from http://www.jroller.com/page/mert?entry=how_to_find_a_uicomponent
         * @param base root Component (parent)
         * @param id UIComponent id
         * @return UIComponent object
         */
        public static UIComponent findComponent(UIComponent base, String id) {
            if (id.equals(base.getId()))
                return base;
    
            UIComponent children = null;
            UIComponent result = null;
            Iterator childrens = base.getFacetsAndChildren();
            while (childrens.hasNext() && (result == null)) {
                children = (UIComponent)childrens.next();
                if (id.equals(children.getId())) {
                    result = children;
                    break;
                }
                result = findComponent(children, id);
                if (result != null) {
                    break;
                }
            }
            return result;
        }
    
        /**
         * Method to create a redirect URL. The assumption is that the JSF servlet mapping is
         * "faces", which is the default
         *
         * @param view the JSP or JSPX page to redirect to
         * @return a URL to redirect to
         */
        public static String getPageURL(String view) {
            FacesContext facesContext = getFacesContext();
            ExternalContext externalContext = facesContext.getExternalContext();
            String url =
                ((HttpServletRequest)externalContext.getRequest()).getRequestURL().toString();
            StringBuffer newUrlBuffer = new StringBuffer();
            newUrlBuffer.append(url.substring(0, url.lastIndexOf("faces/")));
            newUrlBuffer.append("faces");
            String targetPageUrl = view.startsWith("/") ? view : "/" + view;
            newUrlBuffer.append(targetPageUrl);
            return newUrlBuffer.toString();
        }
    
    }
    

Maybe you are looking for

  • Slow down the Satellite C660 - physical memory 93%

    Hello Asked me to replace a screen on my Satellite C660 sons, of whom one.After testing the laptop, I noticed that it was incredible slow. I asked him why he was so slow, and he says he was always slow because he bought 10 months ago to Argos (it s h

  • TDM screw streaming doesn't work is not on the cRIO - error 53?

    Hello I am fairly new to the programming of the aim of RT, and I am running into a problem.  I use a cRIO-9074 to acquire data and I try to log on by using screw TDM streaming.  Unfortunately, I get this error: Error 53 occurred at TDMS Open in Test_

  • Create and extract circle them on a 2D array

    Hello I've tried for 2 days to get this right, but I can't solve this problem. I have a chart 2D containing random integers. I want to create a circle and extract and add all the values that are inside this circle. Entries: -2D-Array = 2D-array with

  • The letters are too thin to read

    On my new Dell desktop with an E1910Hc monitor, there is very high definition, but the letters in many programs (including Word) are too small to read easily. In other words, the letters look as if they were written with a very fine tip pen, making l

  • XPS 15 9550 with 4K display levels of good black out

    I bought a new XPS 15 with the infinity display 4 k, and for some reason, the computer laptop screen suffers from black and white crush extreme. I tried to calibrate the screen, and it seems that the lowest and the highest video are be cut. As a resu