Pass a parameter to a procedure of inserting the order...?

Hi all

I have a requirement where I need to pass the input parameter of the procedure for the insert inside the procedure command...

My procedure continues like that...

PROCEDURE pmproc_1)

A IN VARCHAR2,

B IN VARCHAR2,

C IN VARCHAR2

)

AS

BEGIN

INSERT INTO my_table

(number , activity, fact )

SELECT the number , activity, fact

Of abcd_actv_tbl

Activity WHERE =

AND > = B

AND number = C;

COMMIT;

NULL;

END pmproc_1;

My requirement is that I need to pass the input parameter C to a column in my table which is my_table

so that it becomes...

INSERT INTO my_table (number , activity, , (HERE I NEED to GET THE VALUE of 'C' ) )

SELECT the number , activity, fact

Of abcd_actv_tbl

Activity WHERE =

AND > = B

AND number = C;

Please let me know if I'm unclear...

Thanks in advance...

DEV

Based on what you have provided, I would say that something as simple as:

INSERT INTO my_table (number activity ,c_column )

SELECT the number is, c

       Of abcd_actv_tbl

Activity WHERE =

AND > = B

AND number = C;

Tags: Database

Similar Questions

  • check the trigger quantity - at hand when you insert the order quantity

    Jin
    I have problem with trigger, I use the OE schema
    I have the form master / detail for orders and Order Details, that I need when I insert the order quantity to check the quantity available for each product using the trigger
    I use oracle 10g developer
    any help would be appreciated
    Thank you very much

    2MEO wrote:

    Bamba says:
    What is the structure of your database? and this code that you write?

    don't tell that you don't know how write the SQL query :)

    Thank you for your quick response
    I can write the SQL query
    I use these lines:

    SELECT quantity_on_hand
    INVENTORIES
    WHERE Product_ID =: Product_ID;
    IF: quantity > Quantity_on_hand THEN
    MESSAGE ("the inventory is not enough");
    END IF;

    Why do you think I can't write same SQL query?
    Thank you Bailey

    The query is bad :) there is no INTO clause

    Write it on quantity WHEN-VALIDATE-ITEM and KEY-NEXT-ITEM

     declare
       vquantity number;
    begin
     SELECT quantity_on_hand
      into vquantity
      FROM INVENTORIES
     WHERE Product_ID = :Product_ID;
    
     IF :quantity > vquantity THEN
        MESSAGE ('the inventory is not enough');
         raise form_trigger_failure;
     else
        null; -- or next_item if you are using KEY NEXT ITEM trigger
     END IF;
    
    Exception when no_data_found then
      message('Invalid product ID');
     raise form_trigger_failure;
    END;
    
  • How to pass a parameter in this procedure?

    Hi all

    I'm using oracle 11g.

    I have it here is the procedure.

    I need same procedure that accepts the name of_/ user Id of the useras a parameter and updates the infocenter reorganization for the particular user.

    create or replace

    PROCEDURE MS_SRA_UPDATE_USER_INFO_ORDER (p_user_id number,

    o_error_code ON the NUMBER,

    o_error_message OUT VARCHAR2)

    as

    PRAGMA AUTONOMOUS_TRANSACTION;

    BEGIN

    update of outdoor play of SI_USER_INFOCENTER_T (default_infocenter_flag, display_order) =)

    Select case when Claude = 1 then 'Y' else ' end flag n, Claude of

    (

    Select user_id, infocenter_name, default_infocenter_flag,

    ROW_NUMBER() over (partition by user_id stopped by)

    CASE INFOCENTER_NAME

    When 'A' then 1

    WHEN 'B' THEN 2

    WHEN 'C'                                        THEN 3

    WHEN ' THEN 4

    WHEN 'E' THEN 5

    When "F" then 6

    When 'G' THEN 7

    Of OTHER display_order

    Gladys END)

    OF SI_USER_INFOCENTER_T

    ) internal

    WHERE INNER. USER_ID = EXTERNAL. USER_ID AND INNER.INFOCENTER_NAME = OUTER.INFOCENTER_NAME

    )

    WHEN USER_ID NOT IN (SELECT

    user_id

    OF MS_SRA_USER_ORG_ROLE_ACT_V

    WHERE

    ORG_ENTITY_ID =

    (SELECT ORG_ENTITY_ID FROM SI_ORG_ENTITIES_T WHERE ORG_ENTITY_NAME = 'F'

    ));

    O_ERROR_CODE: = 0;

    O_ERROR_MESSAGE: = NULL;

    COMMIT;

    EXCEPTION

    WHILE OTHERS THEN

    O_ERROR_CODE: = SQLCODE;

    O_Error_Message: = Sqlerrm;

    END MS_SRA_UPDATE_USER_INFO_ORDER;

    I need same procedure that accepts the user Id/username as a parameter and updates the infocenter reorganization for the particular user.

    Thank you

    Dale

    Hello...

    I do not understand your question... Something like that

    CREATE OR REPLACE

    PROCEDURE MS_SRA_UPDATE_USER_INFO_ORDER (p_user_id, NUMBER of)

    o_error_code ON the NUMBER,

    o_error_message OUT VARCHAR2)

    AS

    PRAGMA AUTONOMOUS_TRANSACTION;

    BEGIN

    UPDATE SI_USER_INFOCENTER_T outer_qry

    SET (default_infocenter_flag, display_order) =

    (SELECT CASE WHEN epimachos = 1 THEN 'Y')

    ANOTHER "N".

    Flag of END,

    Claude (SELECT user_id,

    infocenter_name,

    -default_infocenter_flag,

    ROW_NUMBER() over (PARTITION BY user_id ORDER BY

    CASE INFOCENTER_NAME

    WHEN 'A' THEN 1

    WHEN 'B' THEN 2

    WHEN 'C' THEN 3

    WHEN ' THEN 4

    WHEN 'E' THEN 5

    WHEN "F" THEN 6

    WHEN 'G' THEN 7

    Of OTHER display_order

    Gladys END)

    OF SI_USER_INFOCENTER_T

    WHEN USER_ID = p_user_id) inner_qry

    WHERE inner_qry. User_id = outer_qry. USER_ID

    AND inner_qry.INFOCENTER_NAME = outer_qry.INFOCENTER_NAME

    )

    WHERE USER_ID = p_user_id

    AND NOT EXISTS (SELECT 1

    MSU MS_SRA_USER_ORG_ROLE_ACT_V

    WHERE ORG_ENTITY_ID = (SELECT ORG_ENTITY_ID FROM SI_ORG_ENTITIES_T WHERE ORG_ENTITY_NAME = 'F')

    AND msu.user_id = outer_qry. USER_ID

    AND msu.user_id = p_user_id);

    O_ERROR_CODE: = 0;

    O_ERROR_MESSAGE: = NULL;

    COMMIT;

    EXCEPTION

    WHILE OTHERS THEN

    O_ERROR_CODE: = SQLCODE;

    O_Error_Message: = SQLERRM;

    END MS_SRA_UPDATE_USER_INFO_ORDER;

  • Simple procedure to insert data into a table

    Hello

    I am trying to create a simple procedure to insert the data into the emp table.

    He throws after WARNING:

    The procedure that is created with compilation errors.

    CREATE or REPLACE procedure ins_emp (empno emp.empno%type,ename emp.ename%type,deptno emp.deptno%type)

    IS

    Emp.empno%type,P_ename emp.ename%type,P_deptno emp.deptno%type P_empno;

    BEGIN

    Insert into emp values (empno, ename, deptno);

    Ins_emp END;

    And when I try to run it

    execute ins_emp(1111,'abcd',20);

    He is to launch another error:

    PLSQL - 00905:OBJECT SCOTT. INS_EMP is not valid.

    can someone help me with this procedure?

    Thank you

    Hi Frank,.

    I thank very you much for your comments.

    I have a question:

    unless the procedure or function created with compilation errors, we cannot run them right.

  • Pass a parameter to a function to use AS the operator in

    I'm trying to pass a parameter to a function that uses the LIKE '% name_in % ',.
    I don't know how to use...

    the setting is called "name_in".


    Thanks in advance,
    M

    Hello

    Mehrdad says:
    I'm trying to pass a parameter to a function that uses the LIKE '% name_in % ',.
    I don't know how to use...

    the setting is called "name_in".

    Your code should say:

    ... LIKE '%' || name_in || '%'
    

    If name_in is inside the single quotes, it will mean the 7 characters literals 'n', 'a', ', 'e', '_', 'i' and 'n'.
    You want to refer to the variable named name_id, in order to keep the name of the variable outside of the quotation marks.

  • Date Format question - calling a procedure stored on the side of java

    What is the best approach to managing a DATE as a parameter to a procedure?

    (1) the emp table has a column called hire_date and its data type is DATE.
    (2) the procedure has tried to retrieve all employees hired on a specific date, there is a parameter called p_hire_date, type what data it should use? Something like p_hire_date IN emp. HIRE_Date % TYPE? < == is that correct?
    (3) both within the body of the procedure, during the recuperation of registration,
    SELECT first_name, last_name
    FROM EMP
    Where hire_date = p_hire_date < == is that correct? or when should I use to_date()?

    (4) on the coast of Java, when you call this procedure, what data type the hire_date is?

    Thank you
    new2Oracle

    Hello

    Procedure seems correct, do not use to_date.

    Switch argument as a java.sql.Timestamp.

    (Or java.sql.Date If you are absolutely certain that you DATE of Oracle is a component "hour")

    Concerning
    Peter

  • In passing the huge parameter to oracle procedure have a performance hit?

    I have a script attached, in which I am trying process/XML parsing in a table (STAGE_TBL) in the XMLTYPE column and insert the data analyzed in another table (PROCESSED_DATA_TBL). The XML file can be huge up to 2MB, which translates into approximately 2000 + lines of analyzed data. The issue I see is when I pass an XML object to a procedure (STAGE_TBL_PROCESS) to analyze its takes about 10 seconds per XML, but rather than from XML if I directly pick up table in the procedure (STAGE_TBL_PROCESS) passing the ID to be about 0.15 seconds. According to the document while params are passed by reference, so why is this variation of performance?

    Details of database Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64-bit version of PL/SQL Production 11.2.0.3.0 - Production "CORE 11.2.0.3.0 Production" TNS for Linux: Version 11.2.0.3.0 - Production NLSRTL Version 11.2.0.3.0 - Production

    Note: I could not perform SQL_TRACE or DBMS_STATS as I don't have access to them.

    /*
    This one is taking .15 seconds to process an XML with about 2000 rp_sendRow elements
    */

    DECLARE
     
    CURSOR NewStage IS
      
    SELECT *
      
    FROM STAGE_TBL
      
    WHERE  status = 'N'
      
    ORDER BY PUT_TIME ASC;
      SUBTYPE rt_NewStage
    IS NewStage % rowtype;

      ROW_COUNT INTEGER
    := 0;   -- Return value from calling the procedure
      READ_COUNT INTEGER
    := 0;   -- Number of rows read from the stage table
      INSERT_COUNT_TOTAL INTEGER
    := 0;   -- Number of Inserts Inven records
      ERROR_COUNT INTEGER
    := 0;   -- Number of Inven inserts that did inserted more then 1 row in Inven
      PROCESS_STATUS STATUS
    .MmsStatus;
      STATUS_DESCRIPTION STATUS
    .MmsStatusReason;
      ERRMSG VARCHAR2
    (500);

    PROCEDURE STAGE_TBL_PROCESS (IDDATA IN RAW, PROCESS_STATUS OUT VARCHAR2, STATUS_DESCRIPTION OUT VARCHAR2, ROW_COUNT OUT NUMBER) AS
    /*
      This procedure is to parse the XML from STAGE_TBL and populate the data from XML to PROCESSED_DATA_TBL table

      IN PARAMS
      ----------
      IDDATA - ID from STAGE_TBL
      xData - XMLType field from XML_DOCUMENT of STAGE_TBL

      OUT PARAMS
      -----------
      PROCESS_STATUS - The STATUS of parsing and populating PROCESSED_DATA_TBL
      STATUS_DESCRIPTION - The description of the STATUS of parsing and populating PROCESSED_DATA_TBL
      ROW_COUNT - Number of rows inserted into PROCESSED_DATA_TBL
    */

    BEGIN
      
    INSERT ALL INTO PROCESSED_DATA_TBL 
      
    (PD_ID, 
      STORE
    , 
      SALES_NBR
    , 
      UNIT_COST
    , 
      ST_FLAG
    , 
      ST_DATE
    , 
      ST
    , 
      START_QTY
    , 
      START_VALUE
    , 
      START_ON_ORDER
    , 
      HAND
    , 
      ORDERED
    , 
      COMMITED
    , 
      SALES
    , 
      RECEIVE
    , 
      VALUED
    , 
      ID_1
    , 
      ID_2
    , 
      ID_3
    , 
      UNIT_PRICE
    , 
      EFFECTIVE_DATE
    , 
      STATUS
    , 
      STATUS_DATE
    , 
      STATUS_REASON
    ) 
      
    VALUES (IDDATA 
      
    ,store 
      
    ,SalesNo 
      
    ,UnitCost 
      
    ,StWac 
      
    ,StDt 
      
    ,St 
      
    ,StartQty 
      
    ,StartValue 
      
    ,StartOnOrder 
      
    ,Hand 
      
    ,Ordered 
      
    ,COMMITED 
      
    ,Sales 
      
    ,Rec 
      
    ,Valued 
      
    ,Id1 
      
    ,Id2 
      
    ,Id3 
      
    ,UnitPrice 
      
    ,to_Date(EffectiveDate||' '||EffectiveTime, 'YYYY-MM-DD HH24:MI:SS') 
      
    ,'N'  
      
    ,SYSDATE 
      
    ,'XML PROCESS INSERT')  
      
    WITH T AS
      
    ( SELECT STG.XML_DOCUMENT FROM STAGE_TBL STG WHERE STG.ID = IDDATA)  
    -- This is to parse and fetch the data from XML 
      
    SELECT E.* FROM T, XMLTABLE('rp_send/rp_sendRow' PASSING T.XML_DOCUMENT COLUMNS
      store VARCHAR
    (20) PATH 'store'  
      
    ,SalesNo VARCHAR(20) PATH 'sales' 
      
    ,UnitCost NUMBER PATH 'cost' 
      
    ,StWac VARCHAR(20) PATH 'flag' 
      
    ,StDt DATE PATH 'st-dt' 
      
    ,St NUMBER PATH 'st' 
      
    ,StartQty NUMBER PATH 'qty' 
      
    ,StartValue NUMBER PATH 'value' 
      
    ,StartOnOrder NUMBER PATH 'start-on-order' 
      
    ,Hand NUMBER PATH 'hand' 
      
    ,Ordered NUMBER PATH 'order' 
      
    ,Commited NUMBER PATH 'commit' 
      
    ,Sales NUMBER PATH 'sales' 
      
    ,Rec NUMBER PATH 'rec' 
      
    ,Valued NUMBER PATH 'val' 
      
    ,Id1 VARCHAR(30) PATH 'id-1' 
      
    ,Id2 VARCHAR(30) PATH 'id-2' 
      
    ,Id3 VARCHAR(30) PATH 'id-3' 
      
    ,UnitPrice NUMBER PATH 'unit-pr' 
      
    ,EffectiveDate VARCHAR(30) PATH 'eff-dt' 
      
    ,EffectiveTime VARCHAR(30) PATH 'eff-tm' 
      
    ) E;  
      ROW_COUNT 
    := SQL%ROWCOUNT;  -- Not the # of all the rows inserted.
      PROCESS_STATUS 
    := STATUS.PROCESSED;
      
    IF ROW_COUNT < 1 THEN   -- The insert failed Row Count = 0 No exception thrown
      PROCESS_STATUS 
    := STATUS.ERROR;
      STATUS_DESCRIPTION 
    := 'ERROR Did not insert into Pos Inventory. Reason Unknown';
      
    END IF;
      EXCEPTION
      
    WHEN OTHERS THEN
      ROW_COUNT 
    := 0;
      PROCESS_STATUS 
    := STATUS.ERROR;
      STATUS_DESCRIPTION 
    := 'SqlCode:' || SQLCODE || ' SqlErrMsg:' || SQLERRM;
    END;


    BEGIN
      DBMS_OUTPUT
    .enable(NULL);
     
    FOR A_NewStage IN NewStage
      LOOP
      READ_COUNT
    := READ_COUNT + 1;
      STAGE_TBL_PROCESS
    (A_NewStage.ID, PROCESS_STATUS, STATUS_DESCRIPTION, ROW_COUNT);
      INSERT_COUNT_TOTAL
    := INSERT_COUNT_TOTAL + ROW_COUNT;
      
    IF(ROW_COUNT <= 0 OR PROCESS_STATUS = STATUS.ERROR) THEN
      ERROR_COUNT
    := ERROR_COUNT + 1;
      
    UPDATE STAGE_TBL
      
    SET status  = PROCESS_STATUS,
      status_DATE 
    = SYSDATE,
      status_DESCRIPTION 
    = STATUS_DESCRIPTION
      
    WHERE ID  = A_NewStage.ID;
      
    ELSE
      
    UPDATE STAGE_TBL
      
    SET status  = PROCESS_STATUS,
      status_DATE 
    = SYSDATE,
      status_DESCRIPTION 
    = STATUS_DESCRIPTION,
      SHRED_DT 
    = SYSDATE
      
    WHERE ID  = A_NewStage.ID;
      
    END IF;
      
    COMMIT;
     
    END LOOP;
     
    COMMIT;
     
    IF ERROR_COUNT > 0 THEN
      ERRMSG
    := '** ERROR: ' || ERROR_COUNT || ' Stage records did not insert in to the Processed table correctly';
      RAISE_APPLICATION_ERROR
    (-20001,ErrMsg); 
     
    END IF;
      EXCEPTION
      
    WHEN OTHERS THEN
      RAISE
    ;
    END ;

    /*
    This one is taking 10 seconds to process an XML with about 2000 rp_sendRow elements
    */

    DECLARE
     
    CURSOR NewStage IS
      
    SELECT *
      
    FROM STAGE_TBL
      
    WHERE  status = 'N'
      
    ORDER BY PUT_TIME ASC;
      SUBTYPE rt_NewStage
    IS NewStage % rowtype;

      ROW_COUNT INTEGER
    := 0;   -- Return value from calling the procedure
      READ_COUNT INTEGER
    := 0;   -- Number of rows read from the stage table
      INSERT_COUNT_TOTAL INTEGER
    := 0;   -- Number of Inserts Inven records
      ERROR_COUNT INTEGER
    := 0;   -- Number of Inven inserts that did inserted more then 1 row in Inven
      PROCESS_STATUS STATUS
    .MmsStatus;
      STATUS_DESCRIPTION STATUS
    .MmsStatusReason;
      ERRMSG VARCHAR2
    (500);

    PROCEDURE STAGE_TBL_PROCESS (IDDATA IN RAW, xData IN STAGE_TBL.XML_DOCUMENT%TYPE, PROCESS_STATUS OUT VARCHAR2, STATUS_DESCRIPTION OUT VARCHAR2, ROW_COUNT OUT NUMBER) AS
    /*
      This procedure is to parse the XML from STAGE_TBL and populate the data from XML to PROCESSED_DATA_TBL table

      IN PARAMS
      ----------
      IDDATA - ID from STAGE_TBL
      xData - XMLType field from XML_DOCUMENT of STAGE_TBL

      OUT PARAMS
      -----------
      PROCESS_STATUS - The STATUS of parsing and populating PROCESSED_DATA_TBL
      STATUS_DESCRIPTION - The description of the STATUS of parsing and populating PROCESSED_DATA_TBL
      ROW_COUNT - Number of rows inserted into PROCESSED_DATA_TBL
    */

    BEGIN
      
    INSERT ALL INTO PROCESSED_DATA_TBL 
      
    (PD_ID, 
      STORE
    , 
      SALES_NBR
    , 
      UNIT_COST
    , 
      ST_FLAG
    , 
      ST_DATE
    , 
      ST
    , 
      START_QTY
    , 
      START_VALUE
    , 
      START_ON_ORDER
    , 
      HAND
    , 
      ORDERED
    , 
      COMMITED
    , 
      SALES
    , 
      RECEIVE
    , 
      VALUED
    , 
      ID_1
    , 
      ID_2
    , 
      ID_3
    , 
      UNIT_PRICE
    , 
      EFFECTIVE_DATE
    , 
      STATUS
    , 
      STATUS_DATE
    , 
      STATUS_REASON
    ) 
      
    VALUES (IDDATA 
      
    ,store 
      
    ,SalesNo 
      
    ,UnitCost 
      
    ,StWac 
      
    ,StDt 
      
    ,St 
      
    ,StartQty 
      
    ,StartValue 
      
    ,StartOnOrder 
      
    ,Hand 
      
    ,Ordered 
      
    ,COMMITED 
      
    ,Sales 
      
    ,Rec 
      
    ,Valued 
      
    ,Id1 
      
    ,Id2 
      
    ,Id3 
      
    ,UnitPrice 
      
    ,to_Date(EffectiveDate||' '||EffectiveTime, 'YYYY-MM-DD HH24:MI:SS') 
      
    ,'N'  
      
    ,SYSDATE 
      
    ,'XML PROCESS INSERT')  
    -- This is to parse and fetch the data from XML 
      
    SELECT E.* FROM XMLTABLE('rp_send/rp_sendRow' PASSING xDATA COLUMNS
      store VARCHAR
    (20) PATH 'store'  
      
    ,SalesNo VARCHAR(20) PATH 'sales' 
      
    ,UnitCost NUMBER PATH 'cost' 
      
    ,StWac VARCHAR(20) PATH 'flag' 
      
    ,StDt DATE PATH 'st-dt' 
      
    ,St NUMBER PATH 'st' 
      
    ,StartQty NUMBER PATH 'qty' 
      
    ,StartValue NUMBER PATH 'value' 
      
    ,StartOnOrder NUMBER PATH 'start-on-order' 
      
    ,Hand NUMBER PATH 'hand' 
      
    ,Ordered NUMBER PATH 'order' 
      
    ,Commited NUMBER PATH 'commit' 
      
    ,Sales NUMBER PATH 'sales' 
      
    ,Rec NUMBER PATH 'rec' 
      
    ,Valued NUMBER PATH 'val' 
      
    ,Id1 VARCHAR(30) PATH 'id-1' 
      
    ,Id2 VARCHAR(30) PATH 'id-2' 
      
    ,Id3 VARCHAR(30) PATH 'id-3' 
      
    ,UnitPrice NUMBER PATH 'unit-pr' 
      
    ,EffectiveDate VARCHAR(30) PATH 'eff-dt' 
      
    ,EffectiveTime VARCHAR(30) PATH 'eff-tm' 
      
    ) E;  
      ROW_COUNT 
    := SQL%ROWCOUNT;  -- Not the # of all the rows inserted.
      PROCESS_STATUS 
    := STATUS.PROCESSED;
      
    IF ROW_COUNT < 1 THEN   -- The insert failed Row Count = 0 No exception thrown
      PROCESS_STATUS 
    := STATUS.ERROR;
      STATUS_DESCRIPTION 
    := 'ERROR Did not insert into Pos Inventory. Reason Unknown';
      
    END IF;
      EXCEPTION
      
    WHEN OTHERS THEN
      ROW_COUNT 
    := 0;
      PROCESS_STATUS 
    := STATUS.ERROR;
      STATUS_DESCRIPTION 
    := 'SqlCode:' || SQLCODE || ' SqlErrMsg:' || SQLERRM;
    END;


    BEGIN
      DBMS_OUTPUT
    .enable(NULL);
     
    FOR A_NewStage IN NewStage
      LOOP
      READ_COUNT
    := READ_COUNT + 1;
      STAGE_TBL_PROCESS
    (A_NewStage.ID, A_NewStage.XML_DOCUMENT, PROCESS_STATUS, STATUS_DESCRIPTION, ROW_COUNT);
      INSERT_COUNT_TOTAL
    := INSERT_COUNT_TOTAL + ROW_COUNT;
      
    IF(ROW_COUNT <= 0 OR PROCESS_STATUS = STATUS.ERROR) THEN
      ERROR_COUNT
    := ERROR_COUNT + 1;
      
    UPDATE STAGE_TBL
      
    SET status  = PROCESS_STATUS,
      status_DATE 
    = SYSDATE,
      status_DESCRIPTION 
    = STATUS_DESCRIPTION
      
    WHERE ID  = A_NewStage.ID;
      
    ELSE
      
    UPDATE STAGE_TBL
      
    SET status  = PROCESS_STATUS,
      status_DATE 
    = SYSDATE,
      status_DESCRIPTION 
    = STATUS_DESCRIPTION,
      SHRED_DT 
    = SYSDATE
      
    WHERE ID  = A_NewStage.ID;
      
    END IF;
      
    COMMIT;
     
    END LOOP;
     
    COMMIT;
     
    IF ERROR_COUNT > 0 THEN
      ERRMSG
    := '** ERROR: ' || ERROR_COUNT || ' Stage records did not insert in to the Processed table correctly';
      RAISE_APPLICATION_ERROR
    (-20001,ErrMsg); 
     
    END IF;
      EXCEPTION
      
    WHEN OTHERS THEN
      RAISE
    ;
    END ;

    My
    XML with just one rp_sendRow element, it can go upto 2000 rp_sendRow elements
    <?xml version = \"1.0\" encoding = \"UTF-8\"?> 
    <rp_send xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"> 
      
    <rp_sendRow> 
      
    <store>0123</store> 
      
    <sales>022399190</sales> 
      
    <cost>0.01</cost> 
      
    <flag>true</flag> 
      
    <st-dt>2013-04-19</st-dt> 
      
    <st>146.51</st> 
      
    <qty>13.0</qty> 
      
    <value>0.0</value> 
      
    <start-on-order>0.0</start-on-order> 
      
    <hand>0.0</hand> 
      
    <order>0.0</order> 
      
    <commit>0.0</commit> 
      
    <sales>0.0</sales> 
      
    <rec>0.0</rec> 
      
    <val>0.0</val> 
      
    <id-1/> 
      
    <id-2/> 
      
    <id-3/> 
      
    <unit-pr>13.0</unit-pr> 
      
    <eff-dt>2015-06-16</eff-dt> 
      
    <eff-tm>09:12:21</eff-tm> 
      
    </rp_sendRow> 
    </rp_send> 

    The issue I see is when I pass an XML object to a procedure (STAGE_TBL_PROCESS) to analyze its takes about 10 seconds per XML, but rather than from XML if I directly pick up table in the procedure (STAGE_TBL_PROCESS) passing the ID to be about 0.15 seconds.

    In version 11.1, Oracle introduced a new model of storage for the data type XMLType called XML binary.

    Binary XML become the default in 11.2.0.2, to disparage the old storage based on CLOB.

    Binary XML is a format optimized after analysis for the storage and treatment of the XQuery.

    When an XQuery expression is evaluated (through for example XMLTABLE) on an XMLType column stored as binary XML, Oracle can use an ongoing evaluation of XPath that surpasses the query even crushed a transitional XMLType of several order of magnitude.

    You can see that in the action plan of the explain command:

    SQL> SELECT E.*
      2  FROM stage_tbl t
      3     , XMLTABLE('rp_send/rp_sendRow' PASSING t.xml_document
      4         COLUMNS store VARCHAR(20) PATH 'store'
      5               , SalesNo VARCHAR(20) PATH 'sales'
      6               , UnitCost NUMBER PATH 'cost'
      7         ) E ;
    
    Execution Plan
    ----------------------------------------------------------
    Plan hash value: 1134903869
    
    --------------------------------------------------------------------------------
    | Id  | Operation          | Name      | Rows  | Bytes | Cost (%CPU)| Time     |
    --------------------------------------------------------------------------------
    |   0 | SELECT STATEMENT   |           |     1 |  2008 |    32   (0)| 00:00:01 |
    |   1 |  NESTED LOOPS      |           |     1 |  2008 |    32   (0)| 00:00:01 |
    |   2 |   TABLE ACCESS FULL| STAGE_TBL |     1 |  2002 |     3   (0)| 00:00:01 |
    |   3 |   XPATH EVALUATION |           |       |       |            |          |
    --------------------------------------------------------------------------------
    

    When the query is executed on a passenger XMLType (for example, a parameter, or a PL/SQL variable), Oracle cannot run the binary model and use a functional assessment based on memory of the XML DOM-like representation.

    You can see that in the plan to explain it by spoting a 'COLLECTION ITERATOR PICKLER FETCH' operation.

    So what explains the difference (in your version) between treatment from a column of XMLType (stored in binary XML format) or a variable or a parameter.

    From 11.2.0.4 and beyond, things have changed a bit with Oracle, introducing a new transitional level of optimization on XMLType.

    The plan of the explain command will show a "XMLTABLE ASSESSMENT' in this case.

  • Timestamp in passing as a parameter in a procedure

    Hi all
    I want to pass the timestamp as a parameter to a procedure... When I try to run it and to give time as parameters, it is throwing error date format picture ends before converting the entire input string... I'm not able to spend sysdate and systimestamp.


    Start

    Package.PROC_1 (sysdate, sysdate);

    end;

    for example:

    create or replace proc_1 (T_DATE timestamp, v_date2 timestamp) as

    Start

    Select * from emp where to_date(emp_date,'dd-mon-yyyy') between to_date(v_date,'dd-mon-yyyy') and to_Date (v_date2, 'dd-mon-yyyy');

    end proc_1;


    Here emp_date is timestamp.

    Hello

    You don't need to convert it to to_date as all data you transmit and comparing the column are of the same type (timestamp). So you can just put your condition
    emp_date between T_DATE and v_date2

    see you soon

    VT

  • Passing an array as a parameter of java (java controls) for the stored procedure

    Hello

    I use java controls (BEA Weblogic Workshop 8.1) to call a stored procedure and send an array as a parameter to the stored procedure of java. The following code throws an exception 'Fail to convert the internal representation.

    Java code
    import com.bea.control.DatabaseControl.SQLParameter;

    Here I create the java
    int [] = {12,13,14} javaArray.

    The code below is used to create the table from sql to oracle for the procedure
    SQLParameter [] params = new SQLParameter [1];
    Object obj0 = javaArray;
    params [0] = new SQLParameter (obj0, oracle.jdbc.OracleTypes.ARRAY, SQLParameter.IN);

    the code below calls the myFunc in file OJDBCtrl.jcx
    String success = dbControl.testFunc (params);

    OJDBCtrl.jcx
    /**
    * @jc: = sql statement ' call CMNT_TST_PROC (?)).
    */
    String Myfunc (SQLParameter [] param);

    The stored procedure that is used:

    SL_tab IS NUMBER TABLE INDEX BY PLS_INTEGER;
    Procedure cmnt_tst_proc (cmnt_tst sl_tab);
    Procedure cmnt_tst_proc (cmnt_tst sl_tab) is
    BEGIN
    dbms_output.put_line ('Hello');
    END;


    I'm getting the following exception

    Failure = Java.Sql.SqlException: Internal failure to convert the representation: [I@438af4 [ServiceException] >]
    at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:125)
    at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:162)
    at oracle.jdbc.driver.DatabaseError.check_error(DatabaseError.java:861)
    at oracle.sql.ARRAY.toARRAY(ARRAY.java:210)
    at oracle.jdbc.driver.OraclePreparedStatement.setObjectCritical(OraclePreparedStatement.java:7768)
    at oracle.jdbc.driver.OraclePreparedStatement.setObjectInternal(OraclePreparedStatement.java:7449)
    at oracle.jdbc.driver.OraclePreparedStatement.setObjectInternal(OraclePreparedStatement.java:7837)
    at oracle.jdbc.driver.OracleCallableStatement.setObject(OracleCallableStatement.java:4587)
    at weblogic.jdbc.wrapper.PreparedStatement.setObject(PreparedStatement.java:244)
    at com.bea.wlw.runtime.core.control.DatabaseControlImpl._setParameter(DatabaseControlImpl.jcs:1886)
    at com.bea.wlw.runtime.core.control.DatabaseControlImpl.getStatement_v2(DatabaseControlImpl.jcs:1732)
    at com.bea.wlw.runtime.core.control.DatabaseControlImpl.invoke(DatabaseControlImpl.jcs:2591)
    at com.bea.wlw.runtime.core.dispatcher.DispMethod.invoke(DispMethod.java:377)
    at com.bea.wlw.runtime.core.container.Invocable.invoke(Invocable.java:433)
    at com.bea.wlw.runtime.core.container.Invocable.invoke(Invocable.java:406)
    at com.bea.wlw.runtime.core.container.Invocable.invoke(Invocable.java:249)
    at com.bea.wlw.runtime.jcs.container.JcsContainer.invoke(JcsContainer.java:85)
    at com.bea.wlw.runtime.core.bean.BaseContainerBean.invokeBase(BaseContainerBean.java:224)
    at com.bea.wlw.runtime.core.bean.SLSBContainerBean.invoke(SLSBContainerBean.java:109)
    at com.bea.wlwgen.StatelessContainer_ly05hg_ELOImpl.invoke(StatelessContainer_ly05hg_ELOImpl.java:153)
    ...

    Can you please let me know, what am I doing wrong and how can I pass an array to a procedure/function using java controls.

    Any help will be much appreciated.



    Published by: user12671762 on February 24, 2010 05:03

    Published by: user9211663 on February 24, 2010 21:04

    Try using an oracle.sql.ARRAY with a nested table or varray instead of a table index. Create the type SQL and Java object as follows

        SQL> create type sl_tab as varray(3) of integer;
        Java:
            ArrayDescriptor ad = ArrayDescriptor.createDescriptor
                (".SL_TAB", java.sql.Connection);
            Object elements = new Object[3];
            elements[0] = new Integer(12);
            elements[1] = new Integer(13);
            elements[2] = new Integer(14);
            oracle.sql.ARRAY array =
                new oracle.sql.ARRAY(ad, oracle.jdbc.OracleTypes.ARRAY, elements);
            SQLParameter[] params = new SQLParameter[1];
            params[0] =
                new SQLParameter(array, oracle.jdbc.OracleTypes.ARRAY, SQLParameter.IN);
            String succ = dbControl.testFunc(params);
    

    I don't think that you can pass an array of Java, this is why you have more success using an oracle.sql.ARRAY with a SQL varray. -Michael-

  • The execution of a function in the procedure, passed as parameter string

    Hello

    He must create a function, pass the name of the function to a procedure, and then run this function in the procedure.

    For example:

    Hello from the FUNCTION to CREATE or REPLACE

    RETURN NUMBER

    IS

    BEGIN

    RETURN 23;

    END;

    /

    CREATE OR REPLACE PROCEDURE pro_fun (v_fun VARCHAR2, v_cal OUT NUMBER)

    IS

    BEGIN

    v_cal: = exec v_fun; <-error on this line

    END;

    /

    Now my plsql block annonymous where I'm passing function as sting of procedure:

    DECLARE

    VARCHAR2 (30) v1.

    NUMBER of v2;

    BEGIN

    v1: = "Hello";

    pro_fun (v1, v2);

    DBMS_OUTPUT. Put_line ('VALUE IS' | v2);

    END;

    /

    pro_fun (v1, v2);

    *

    ERROR on line 6:

    ORA-06550: line 6, column 1:

    PLS-00905: object SCOTT.PRO_FUN is not valid

    ORA-06550: line 6, column 1:

    PL/SQL: Statement ignored

    How below line of procedure must be written to perform this function.

    v_cal: = exec v_fun;

    Try something like this:

    create or replace function forum_hello return number

    is

    Start

    Back to 123;

    end forum_hello;

    /

    create or replace procedure forum_call_function (function_name_in in varchar2)

    is

    number of l_returnvalue;

    Start

    run immediately "begin: l: = ' |" function_name_in |'; end;' using l_returnvalue;

    dbms_output.put_line (l_returnvalue);

    end;

    /

    exec forum_call_function ('forum_hello')

    Sincere greetings,

    Patrick Barel

  • Quote from passing in parameter

    Hello

    I have a query that I migrated from the sql server database. She is given below. I'm passing an apostrophe as a parameter to this request, but it always retrieves number of 0. But I have 1 table insert. As a solution to this, I solved this problem for sql server passing two quotation mark (single quote by replacing double quotes). This same solution also applies here. When passing a parameter with apostrophe in there, it will replace the single quote with double quotes and then pass it to the below given procedure. But still, it does not work properly. I have a similar query to retrieve this record and it works very well. No idea why the query below does not work properly?

    PROCEDURE GetEntUserGroupCountWithOther
    (
    ppGroupName IN VARCHAR2 DEFAULT '% ',.
    CP1 IN OUT SYS_REFCURSOR
    )
    AS
    BEGIN

    OPEN FOR Cp1
    SELECT COUNT (*) TotalRecords
    (SELECT ID, EnterpriseUserGroupId,
    Name of NAME,
    Description DESCRIPTION,
    IsDefault
    OF EnterpriseUserGroup) T1
    WHERE UPPER (NAME) LIKE + UP ('%' | ppGroupName |) '%');

    END;

    Thank you

    Published by: user10768079 on July 14, 2009 22:56

    user10768079 wrote:
    Sorry I forgot to mention that I'm passing parameters of .NET. It works very well for SQL Server and procedure in oracle that retrieves the record. But he doesn't get number for the query I posted.

    As you can see on my demo, it is show a County...

    >

    If I replace the value of the parameter whose I am the concatenation in query to hardcode ' demo "is then it works very well for me.

    Then you have confirmed what I just said, it works... should be the way you spend your settings in this case

  • optimize a stored procedure to insert data

    Hello

    I followed table structures,

    Client:

    ID number pk,

    name varchar2 (100),

    number of autooption);

    CustItem:

    The ItemId number,

    Number of CustomerId

    CustItemAdd:

    (ItemId number,

    Number of assets)

    CustItemAddLog:)

    The ItemId number,

    Number of CustomerId,

    LogDate date,

    autooption)

    I wrote after a stored procedure to load the elements of CustItemAdd to CustItem. My query select fetch 18000000, so finally I insert these many records in

    2Tables, as in stored proc.

    Loading of the required data, it takes about 7 hours to complete. I used addition of suspicion, he worked a little faster in sql directly, but in sp for the two statements,

    It is throwing error that I can't use it in parallel.

    Can I use a way to insert quickly data?

    create or replace procedure SPCUSTITEMNEWSAVE

    (sFlag out varchar2)

    is

    Start

    -Boot flag

    sFlag: = '0';

    --===============================================================

    -Insert new elements to save the table.

    --=================================================================

    INSERT INTO CustItemAddLog

    SELECT

    ca.itemId,

    Cust,

    SYSDATE,

    Cust.autooption

    OF CustItemAdd CA,.

    Customer Cust

    WHERE THERE IS NO

    (SELECT 1 FROM custitem WHERE customer = Cust AND item = ca.itemid)

    )

    AND cust.autooption in (1,2)

    AND (ca.active = 0

    GOLD ca.active IS NULL);

    --===============================================================

    -Insert new elements.

    --===============================================================

    INSERT INTO CustItem

    (

    Customer,

    Agenda

    )

    SELECT

    Cust,

    CA. Item,

    100

    OF CustItemAdd CA,.

    Customer Cust

    WHERE THERE IS NO

    (SELECT 1 FROM custitem WHERE customer = Cust AND item = ca.itemid)

    )

    AND cust.autooption in (1,2)

    AND (ca.active = 0

    GOLD ca.active IS NULL);

    --===============================================================

    -Remove the downloaded items.

    --===============================================================

    DELETE CustItemAdd

    WHERE THERE ARE

    (SELECT point above CustItem WHERE, .itemid = CustItemAdd.itemid

    );

    COMMIT;

    sFlag: = '100';

    --================================================================

    -Exception handling

    --================================================================

    EXCEPTION

    WHILE OTHERS THEN

    sFlag: = '300'-| SQLERRM;

    ROLLBACK;

    end;

    Little does not return the error code in a parameter out. Next EXCEPTION WHILE OTHERS without STIMULUS is completely false. Never do this.

    Now in regards to performance try using the INSERT all statement.

    create or replace procedure spcustitemnewsave
    is
    Start
    Insert / * + APPEND * /.
    all the
    in custitemaddlog
    (
    ItemId
    CustomerId
    LogDate
    autooption
    )
    values)
    ItemId
    id
    dt
    autooption
    )
    in custitem
    (
    customer
    element
    )
    values)
    ID
    element
    )
    Select ca.itemid
    Cust
    sysdate dt


    cust.autooption
    from custitemadd ca
    customer cust
    where there is no
    (
    Select 1
    of custitem
    where customer = Cust
    and item = ca.itemid
    )
    and cust.autooption in (1,2)
    and)
    CA.active = 0 or
    CA.active is null
    );

    delete custitemadd
    where there are
    (
    Select the item
    the custitem this
    where ci.itemid = custitemadd.itemid
    );

    commit;
    end;

  • Insert the output of a refcursor procedure into a table

    Hello

    I met a scenario in which I need to put the insert records returned by a procedure using refcursor, at a table.

    I followed the instructions in PL/SQL 101: understanding Refcursor (PL/SQL 101: understanding Ref Cursor am unfortunately still not able to do so.)

    Here is my sample codes. (Copied here as advised by the new Member)
    create or replace PROCEDURE TEST_PROCEDURE1 ( p_cursor OUT SYS_REFCURSOR)
    AS
    BEGIN
    OPEN p_cursor FOR
    SELECT C1,C2
    FROM TEST_USER.test_table4procedure;
    END;
    I check the result using the following statement, which gives results.
    variable rc refcursor;
    exec TEST_USER.TEST_PROCEDURE1 (:rc)
    print rc;
    Now, I want to be able to use the output and insert the data into a table. That's how I came across this thread.

    I created the types and function...
    create or replace type test_user.type_table1 as object(var1 varchar2(50),var2 varchar2(50));
    create or replace type test_user.type_table2 as table of test_user.type_table1;
    
    create or replace function test_user.test_function1 (rc in sys_refcursor )
    return test_user.type_table2 is
    v_emptype test_user.type_table2 := test_user.type_table2(); -- Declare a local table structure and initialize it
    v_cnt number := 0;
    v_rc sys_refcursor;
    v_var1 varchar2(20);
    v_var2 varchar2(20);
    begin
    v_rc := rc;
    loop
    fetch v_rc into v_var1, v_var2;
    exit when v_rc%NOTFOUND;
    v_emptype.extend;
    v_cnt := v_cnt + 1;
    v_emptype(v_cnt) := test_user.type_table1(v_var1, v_var2);
    end loop;
    close v_rc;
    return v_emptype;
    end;
    After that, I want to be able to view the records by using the function... so I used the instructions below...
    variable rc refcursor;
    exec TEST_USER.TEST_PROCEDURE1 (:rc)
    SELECT * FROM TABLE(test_user.test_function1(:rc));   
    However, it fails with the error

    Error from line 3 in order:
    SELECT * FROM TABLE (test_user.test_function1 (:rc))
    Error report:
    SQL error: Missing a setting IN or OUT to index: 1

    Help, please...

    Your code does not work for a simple reason. SYS_REFCURSOR parameters must be in IN OUT mode. Check if the RC is open when he switched mode:

    create or replace type type_table1 as object(var1 varchar2(50),var2 varchar2(50))
    /
    create or replace type type_table2 as table of type_table1
    /
    create or replace PROCEDURE TEST_PROCEDURE1 (p_cursor IN OUT SYS_REFCURSOR)
    AS
    BEGIN
    OPEN p_cursor FOR
    SELECT ENAME,JOB FROM EMP;
    END;
    /
    create or replace function test_function1 (rc in sys_refcursor )
    return type_table2 is
    v_emptype type_table2 := type_table2(); -- Declare a local table structure and initialize it
    v_cnt number := 0;
    v_var1 varchar2(20);
    v_var2 varchar2(20);
    begin
    if rc%isopen
      then
        dbms_output.put_line('rc is open');
      else
        dbms_output.put_line('rc is not open');
     end if;
    loop
    fetch rc into v_var1, v_var2;
    exit when rc%NOTFOUND;
    v_emptype.extend;
    v_cnt := v_cnt + 1;
    v_emptype(v_cnt) := type_table1(v_var1, v_var2);
    end loop;
    close rc;
    return v_emptype;
    end;
    /
    variable rc refcursor
    exec TEST_PROCEDURE1(:rc)
    set serveroutput on
    SELECT * FROM TABLE(test_function1(:rc))
    /
    SELECT * FROM TABLE(test_function1(:rc))
                        *
    ERROR at line 1:
    ORA-01001: invalid cursor
    ORA-06512: at "SCOTT.TEST_FUNCTION1", line 15
    
    rc is not open
    SQL> 
    

    Now IN OUT parameter edit mode:

    set serveroutput off
    create or replace function test_function1 (rc in out sys_refcursor )
    return type_table2 is
    v_emptype type_table2 := type_table2(); -- Declare a local table structure and initialize it
    v_cnt number := 0;
    v_var1 varchar2(20);
    v_var2 varchar2(20);
    begin
    if rc%isopen
      then
        dbms_output.put_line('rc is open');
      else
        dbms_output.put_line('rc is not open');
     end if;
    loop
    fetch rc into v_var1, v_var2;
    exit when rc%NOTFOUND;
    v_emptype.extend;
    v_cnt := v_cnt + 1;
    v_emptype(v_cnt) := type_table1(v_var1, v_var2);
    end loop;
    close rc;
    return v_emptype;
    end;
    /
    variable rc refcursor
    exec TEST_PROCEDURE1(:rc)
    set serveroutput on
    declare
    v_emptype type_table2 := type_table2();
    begin
    v_emptype := test_function1(:rc);
    end;
    /
    rc is open
    
    PL/SQL procedure successfully completed.
    
    SQL> 
    

    Problem is that you can't call the procedure/function with parameters in/out OUT of SQL.

    SY.

  • Change in the merger of insert and create a procedure for updating the records after

    Hello

    I have a table that contains about 50 M lines of partition, and every day I have an application that performs a merge to insert records statement about 100 k per day and it's 300 M updates a day.

    Because I both update and insert the application performs a merge.
    I need to make at least 500 M, updated day by day, and for this reason this solution doesn't have enough performance for what I'm asking.

    I think another solution that I will try to implement now, and I just posted this in an attempt to get help on the option that I may have to do.

    I want to start putting in place:
    -Locations is updated 'last_record_date' using 'KEY1' and 'Key2' "KEY3";
    -Change the application to only inserts into a temporary table.
    -Have two procedures, one that takes the new records from the temporary table and inserts it into the final table, and another that selects records which is updated and perform an update.
    -This two procedures will choose the records and delete them from the temporary table (or mark them as updated\inserted).

    The volume is very large, so performance is a challenge! That's why I'm writing this, because a solution with enough performance for the intermediate stage will be difficult.
    My final table is partitioned by date and the date is the area that I need to update (instead of create daily partitions in order to reduce the frequency of the movement of the line, I create monthly partitions)!
    It is currently my table definition:
    CREATE TABLE MY_TEST_TABLE
        (KEY1                           VARCHAR2(50 BYTE) ,
        KEY2                         VARCHAR2(50 BYTE) NOT NULL,
        KEY3                           VARCHAR2(50 BYTE) ,
        last_record_date                    VARCHAR2(50 BYTE) NOT NULL)
      PCTFREE     10
      INITRANS    1
      MAXTRANS    255
       STORAGE   (
        BUFFER_POOL DEFAULT
      )
      NOCACHE
      MONITORING
      ENABLE ROW MOVEMENT
      PARTITION BY RANGE (last_record_date)
      (
      PARTITION MY_TEST_TABLE_201112 VALUES LESS THAN ('20120101')
      PCTFREE     10
      INITRANS    1
      MAXTRANS    255
      NOLOGGING,
      PARTITION MY_TEST_TABLE_201201 VALUES LESS THAN ('20120201')
      PCTFREE     10
      INITRANS    1
      MAXTRANS    255
      NOLOGGING,
      PARTITION MY_TEST_TABLE_201202 VALUES LESS THAN ('20120301')
      PCTFREE     10
      INITRANS    1
      MAXTRANS    255
      NOLOGGING,
      PARTITION def VALUES LESS THAN (MAXVALUE)
      PCTFREE     10
      INITRANS    1
      MAXTRANS    255
      NOLOGGING
      )
      NOPARALLEL
    /
    
    
    
    -- Constraints for MY_TEST_TABLE
    
    ALTER TABLE MY_TEST_TABLE
    ADD CHECK ("KEY1" IS NOT NULL)
    /
    
    ALTER TABLE MY_TEST_TABLE
    ADD CHECK ("KEY2" IS NOT NULL)
    /
    
    ALTER TABLE MY_TEST_TABLE
    ADD CHECK ("KEY3" IS NOT NULL)
    /
    ALTER TABLE MY_TEST_TABLE
    ADD CONSTRAINT pk_MY_TEST_TABLE PRIMARY KEY (KEY1, KEY2, KEY3)
    USING INDEX
      PCTFREE     10
      INITRANS    2
      MAXTRANS    255
    /
    Thank you
    Ricardo Tomas

    naoseionome wrote:
    Hello

    My version is:
    Oracle Database 11 g Enterprise Edition Release 11.2.0.2.0 - 64 bit Production

    It's the DOF I used to create the database.

    The merger is common during every day for about 10 M records.

    There are several methods to do the update, but they do sequencially to avoid deadlocks (because I can't control the source and each process can update the same keys.

    The update uses "KEY1, KEY2, KEY3" to update the value 'LAST_RECORD_DATE' have impact by being date or varchar2?

    I'm still waiting to receive permissions in order to follow up the matter, but in the meantime, in that I am trying to implement this work around in order to accelerate a development in the case where it would be necessary! Comments only I have at the moment, it is that he is not able to process the total amount of records timely (order book is generated).

    Thank you
    Ricardo

    Well, the first thing we do is to change the type of data type varchar to a date. The main impact is that a date is not a string, it's a date. If you are adding data processes in different date formats (which is possible when you use a character to store information) you're going to be very sad (good luck converting back an effective date).

    An example of how this can happen easily.

    ME_TUBBZ?select to_char(sysdate) from dual;
    
    TO_CHAR(SYSDATE)
    -----------------------------
    12-jan-2012 10 55:33
    
    1 row selected.
    
    Elapsed: 00:00:00.01
    ME_TUBBZ?alter session set nls_date_format = 'yyyy-mon-dd';
    
    Session altered.
    
    Elapsed: 00:00:00.01
    ME_TUBBZ?select to_char(sysdate) from dual;
    
    TO_CHAR(SYSDATE)
    --------------------
    2012-jan-12
    
    1 row selected.
    
    Elapsed: 00:00:00.00
    

    Assuming that the client passes the column as an Oracle DATE will make an (implicit) conversion to store the data as a string, which will be based on the current settings of the NLS for the session. This allows also for someone to completely non-jour the information in the column (super bad). It's just really bad form to use strings to store dates, numbers, anything that is not naturally a string.

    Based on the description of your problem, I can't imagine how your partitioning scheme performs one action in another that require more work in order to process the updates (which are most of your needs). Partitioning does not equate to increase performance. It is a tool that, like every tool has its place, but I do not think that this is justified for what you do (certainly not how you currently use it anyway).

    I say no partitioning can not be useful for you, but I don't think that on the column that you are currently using is 'good '.

    Something I would like to personally study (must be able to compare this approach to your course, if you need parameters for comparison) if I were you would be using a Table Index organized for it. It will take more time to perform the operations insertion, but that is a small part of all the work that you do for this process. For updates, it should eliminate a lot of IO, assuming that you are doing an INDEX seek followed by a table access by ROWID to perform updates. This recommendation assumes that everything you said is true. You have 4 columns in your table, of which 3 are components of the primary key and the 4th is a date (note I did not string :)) and that you refresh mainly, not fit.) Also that you have no 'secondary' on this entity index (and none are needed).

    I would investigate this approach before the solution of temporary table that you are currently studying.

    See you soon,.

  • Problems in passing a parameter through a button, php

    Hi all

    I'm new to the forum and web design and Dreamweaver, please go a little easy on me!

    I am currently doing a fantasy football website in Dreamweaver and phpmyadmin. When a user visits the site and wants to enter the competition, he clicks on record that brings to the top of registration page. There they can complete the form containing the information, username, password etc. When they click the button Save at the bottom of the form, their details are inserted into the users table in the database, and they passed on the next page, where they are called upon to choose their team. Details of the team are kept in a separate table in the database.

    What I'm trying to do is to pass the user name that is created in the form of registry to the team page choose as a parameter.

    Currently, my button code is as follows:

    < input type = "submit" value = "Insert file" / >

    and after sql code inserting goto is currently?

    $insertGoTo = "pickteam.php";

    In another section of the site, I spent a parameter with a link as follows:


    < a href = "editgoalkeeper.php? gkid_gk = <?" PHP echo $row_rs_viewgks ["gkid_gk"];? > ">"

    but I'm not sure about how to pass a parameter by using a "submit" button, can someone help me please?

    You should use PHP sessions and store the username as a session variable.

    Start page that registers the user with session_start();. You can then save the username to a session variable:

    session_start();
    if (isset ($_POST['username'])) {
      $_SESSION['username'] = $_POST['username'];
    }
    

    Subsequently, $_SESSION ['username'] will be available on any page that begins with session_start();

Maybe you are looking for