Explain the plans differ as the parameter value changes

Hi all

My colleague posted a similar question a few days before. Happened because of some bad index. But now we are in a strange situation.

DB:
SQL> select * from v$version;

BANNER
----------------------------------------------------------------
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Prod
PL/SQL Release 10.2.0.1.0 - Production
CORE    10.2.0.1.0      Production
TNS for 32-bit Windows: Version 10.2.0.1.0 - Production
NLSRTL Version 10.2.0.1.0 - Production
We use the query below and was working fine until 13.
SQL> explain plan for
  2  SELECT *
  3    FROM gacc_dtl_v1  acc,
  4         gcus_dtl_v1  cus,
  5         gtxn_dtl_v1  txn
  6   WHERE txn.customer_id = cus.customer_number(+)
  7   AND txn.batch_id = cus.batch_id(+)
  8   AND txn.account_number = acc.id
  9   AND acc.batch_id = '130609'
 10   AND cus.batch_id(+) = '130609'
 11   AND txn.batch_id = '130609' AND cus.target IN ('30');

Explained.

SQL> select * from table(dbms_xplan.display);

PLAN_TABLE_OUTPUT
-------------------------------------------------------------------------------------------------------------
Plan hash value: 566819363

-------------------------------------------------------------------------------------------------------------
| Id  | Operation                     | Name                | Rows  | Bytes |TempSpc| Cost (%CPU)| Time     |
-------------------------------------------------------------------------------------------------------------
|   0 | SELECT STATEMENT              |                     |     1 |   947 |       | 16963   (1)| 00:03:24 |
|   1 |  NESTED LOOPS                 |                     |     1 |   947 |       | 16963   (1)| 00:03:24 |
|*  2 |   HASH JOIN                   |                     |    41 | 26322 |  9136K| 16799   (1)| 00:03:22 |
|*  3 |    TABLE ACCESS BY INDEX ROWID| GTXN_DTL_V1         | 31055 |  8764K|       |  2430   (1)| 00:00:30 |
|*  4 |     INDEX RANGE SCAN          | GTXN_V1_BATCHID_NDX | 60524 |       |       |   156   (2)| 00:00:02 |
|*  5 |    TABLE ACCESS BY INDEX ROWID| GCUS_DTL_V1         |   176K|    59M|       | 10869   (1)| 00:02:11 |
|*  6 |     INDEX RANGE SCAN          | IDX_CUS2_V1         |   198K|       |       |   527   (2)| 00:00:07 |
|   7 |   TABLE ACCESS BY INDEX ROWID | GACC_DTL_V1         |     1 |   305 |       |     4   (0)| 00:00:01 |
|*  8 |    INDEX RANGE SCAN           | GACC_DTL_V1_IDX     |     1 |       |       |     3   (0)| 00:00:01 |
-------------------------------------------------------------------------------------------------------------

Predicate Information (identified by operation id):
---------------------------------------------------

   2 - access("TXN"."CUSTOMER_ID"="CUS"."CUSTOMER_NUMBER" AND "TXN"."BATCH_ID"="CUS"."BATCH_ID")
   3 - filter("TXN"."CUSTOMER_ID" IS NOT NULL)
   4 - access("TXN"."BATCH_ID"='130609')
   5 - filter("CUS"."TARGET"='30')
   6 - access("CUS"."BATCH_ID"='130609')
   8 - access("TXN"."ACCOUNT_NUMBER"="ACC"."ID" AND "ACC"."BATCH_ID"='130609')
       filter(SUBSTR("TXN"."ACCOUNT_NUMBER",1,3)=SUBSTR("ACC"."ID",1,3))

26 rows selected.
It shows a hash join and nested with cost 16963 loops and gives the result in 2-3 seconds. It gives the same plan to explain even now if we use batch_id = '130609'

Now all of a sudden from yesterday it gives different explain the plan below. Only difference in the query below is the value of batch_id
SQL> explain plan for
  2  SELECT *
  3    FROM gacc_dtl_v1  acc,
  4         gcus_dtl_v1  cus,
  5         gtxn_dtl_v1  txn
  6   WHERE txn.customer_id = cus.customer_number(+)
  7   AND txn.batch_id = cus.batch_id(+)
  8   AND txn.account_number = acc.id
  9   AND acc.batch_id = '150609'
 10   AND cus.batch_id(+) = '150609'
 11   AND txn.batch_id = '150609' AND cus.target IN ('30');

Explained.

SQL> select * from table(dbms_xplan.display);

PLAN_TABLE_OUTPUT
------------------------------------------------------------------------------------------------------------
Plan hash value: 773603995

--------------------------------------------------------------------------------------------------------
| Id  | Operation                     | Name                   | Rows  | Bytes | Cost (%CPU)| Time     |
--------------------------------------------------------------------------------------------------------
|   0 | SELECT STATEMENT              |                        |     1 |   947 |    77   (0)| 00:00:01 |
|   1 |  NESTED LOOPS                 |                        |     1 |   947 |    77   (0)| 00:00:01 |
|   2 |   NESTED LOOPS                |                        |     1 |   594 |    73   (0)| 00:00:01 |
|   3 |    TABLE ACCESS BY INDEX ROWID| GACC_DTL_V1            |     1 |   305 |     4   (0)| 00:00:01 |
|*  4 |     INDEX RANGE SCAN          | GACC_DTL_BATCH_ID_INDX |     1 |       |     3   (0)| 00:00:01 |
|*  5 |    TABLE ACCESS BY INDEX ROWID| GTXN_DTL_V1            |     1 |   289 |    69   (0)| 00:00:01 |
|*  6 |     INDEX RANGE SCAN          | IDX_TXN2_V1            |   125 |       |    12   (0)| 00:00:01 |
|*  7 |   TABLE ACCESS BY INDEX ROWID | GCUS_DTL_V1            |     1 |   353 |     4   (0)| 00:00:01 |
|*  8 |    INDEX RANGE SCAN           | IDX_CUS3_V1            |     1 |       |     3   (0)| 00:00:01 |
--------------------------------------------------------------------------------------------------------

Predicate Information (identified by operation id):
---------------------------------------------------

   4 - access("ACC"."BATCH_ID"='150609')
   5 - filter("TXN"."CUSTOMER_ID" IS NOT NULL AND "TXN"."BATCH_ID"='150609')
   6 - access("TXN"."ACCOUNT_NUMBER"="ACC"."ID")
       filter(SUBSTR("TXN"."ACCOUNT_NUMBER",1,3)=SUBSTR("ACC"."ID",1,3))
   7 - filter("CUS"."TARGET"='30')
   8 - access("CUS"."BATCH_ID"='150609' AND "TXN"."CUSTOMER_ID"="CUS"."CUSTOMER_NUMBER")
       filter("TXN"."BATCH_ID"="CUS"."BATCH_ID")

26 rows selected.
It shows two loops nested with cost 77, but works for hours. Very very slow.. No idea what's going on...
 select i.table_name,i.index_name,index_type,c.column_name,c.column_position,e.column_expression
   from all_indexes i, all_ind_columns c,all_ind_expressions e
   where c.index_name = i.index_name
   and e.index_name(+) = i.index_name
   and i.table_name in ('GCUS_DTL_V1','GACC_DTL_V1','GTXN_DTL_V')
   order by 1,2,4

TABLE_NAME     INDEX_NAME          INDEX_TYPE          COLUMN_NAME     COLUMN_POSITION     COLUMN_EXPRESSION
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
GACC_DTL_V1     GACC_DTL_BATCH_ID_INDX     NORMAL               BATCH_ID          1     
GACC_DTL_V1     GACC_DTL_V1_IDX          NORMAL               BATCH_ID          2     
GACC_DTL_V1     GACC_DTL_V1_IDX          NORMAL               ID               1     
GACC_DTL_V1     GACC_DTL_V1_IDX2     FUNCTION-BASED NORMAL     SYS_NC00101$          1     SUBSTR("ID",1,3)
GACC_DTL_V1     IDX_ACC1_V1          NORMAL               CATEGORY          1     
GACC_DTL_V1     IDX_ACC3_V1          FUNCTION-BASED NORMAL     SYS_NC00099$          1     "CUSTOMER_NUMBER"||'.'||"LIMIT_REF"
GACC_DTL_V1     IDX_ACC4_V1          FUNCTION-BASED NORMAL     SYS_NC00100$          1     "CUSTOMER_NUMBER"||'.000'||"LIMIT_REF"
GACC_DTL_V1     IDX_ACC5_V1          NORMAL               POSTING_RESTRICT     1     
GACC_DTL_V1     IDX_CUS5_V1          NORMAL               CUSTOMER_NUMBER          1     
GACC_DTL_V1     IDX_CUS6_V1          NORMAL               LIMIT_REF          1     
GCUS_DTL_V1     GCUS_DTL_V1_IDX1     NORMAL               CUSTOMER_NUMBER          1     
GCUS_DTL_V1     IDX_CUS2_V1          NORMAL               BATCH_ID          1     
GCUS_DTL_V1     IDX_CUS3_V1          NORMAL               BATCH_ID          1     
GCUS_DTL_V1     IDX_CUS3_V1          NORMAL               CUSTOMER_NUMBER          2     
GCUS_DTL_V1     IDX_CUS3_V1          NORMAL               INDUSTRY          4     
GCUS_DTL_V1     IDX_CUS3_V1          NORMAL               SECTOR               3     
GCUS_DTL_V1     IDX_CUS4_V1          FUNCTION-BASED NORMAL     SYS_NC00078$          1     SUBSTR("DATE_STAMP",1,6)
We are also do not understand why the filter (SUBSTR ("TXN". ""»(, 1, 3) ACCOUNT_NUMBER = SUBSTR ("VAC". " ID", 1, 3)) is used in both queries.

All tables are analyzed today.

Please share your thoughts on this.

Thanks in advance,
Jac

Jac says:

L     H     NUM_BUCKETS     LAST_ANALYZED     SAMPLE_SIZE     HISTOGRAM
------------------------------------------------------------------------------------------------------------------------------------------------
010109     311208     235     13/Jun/2009     5,343     FREQUENCY

You have a histogram of frequencies on the BATCH_ID column missing at least 2 values according to your index statistics (235 buckets vs 237 separate keys).

If the value that you use in the query is missing then this could be the explanation for the estimation of cardinality bad (since you're on pre - 10.2.0.4. In 10.2.0.4 that this behavior changes).

The size of the sample of 5 300 lines is also very low, given the 57,000,000 lines according to the index statistics.

You have two options (which can be combined):

-Increase the size of the sample using a parameter explicitly estimate_percent, for example at least 10 percent

exec DBMS_STATS. GATHER_TABLE_STATS (null, 'GACC_DTL_V1', estimate_percent-online 10, method_opt => 'FOR COLUMNS SIZE 254 BATCH_ID,' waterfall-online fake)

-Get rid of the histogram

exec DBMS_STATS. GATHER_TABLE_STATS (null, 'GACC_DTL_V1', method_opt-online 'FOR BATCH_ID COLUMNS SIZE 1', cascade-online fake)

Note: Is there a particular reason why you store numbers in varchar columns? This might be the reason why Oracle believes that it must generate a histogram using the AUTO SIZE option.

I tend to promote to remove from the histogram, but you must first verify the data if the BATCH_ID values are spread out and the histogram is reasonable:

select
        batch_id
      , count(*)
from
        gacc_dtl_v1
group by
        batch_id;

No constarints are at the DB level. All are processed Application level.

Have you checked this in DBA/ALL/USER_CONSTRAINTS?

It's also a good idea to have constraints at the level of the DB. It keeps your data consistent and quite often helps the optimizer. It allows even 10.2 and later to make things like the elimination of a join table that can make a huge difference in performance.

Kind regards
Randolf

Oracle related blog stuff:
http://Oracle-Randolf.blogspot.com/

SQLTools ++ for Oracle (Open source Oracle GUI for Windows):
http://www.sqltools-plusplus.org:7676 /.
http://sourceforge.NET/projects/SQLT-pp/

Published by: Randolf Geist on June 16, 2009 11:48

Comment added constraints

Tags: Database

Similar Questions

  • Default for the parameter value date

    We use Oracle bi apps 7.9.5. In that when an organization dimension that we don't pass any value of loading
    setting $$ SRC_EFF_TO_DT. It is supported as on 01/01/1753. When the default value of 01/01/1753 is set?

    Is there a way we can define the parameter value globally for all dimensions in Informatica or DAC?

    01/01/1753 is Informatica's default date value. It uses this value when the parameter is passed to the parameter file and no default is mentioned in Informatica. To set the default value in Informatica, you may need to change all the mappings of one by one.

    Easy by default is to set this parameter to DAC - Design-> tab settings of the Source System. This will last for all workflows walked through the DCA during execution.

    Ash

  • How to get the parameter values of a step type custom when I create file and adding a type of step seq

    I use lv 8.5 and teststand 4.0.

    I did a step type custom and recorded at the MyTypes.ini in pallets of type.

    I specified a default module by opening the properties of the custom step of *.ini type window, then I put some values of the parameters.

    T1) when I open teststand and I add the custom step type manaully in seq file, the labview module parameter values are represented.

    But, if to use file (create and add support prototype stage), the labview module parameter values has the default value.

    Using joint file, how to get the setting custom step type values I put in *.ini?

    Q2) each type of step are automatically by name through the use of LoadTypePaletteFilesEx. When I open teststand and I add the custom step type manaully in seq file, the module is loaded automatically. Inside the attachment, I use a prototype of charge and a fixed path where the module labview is to load the labview module.

    Can I load module automatically without using a prototype of charge or how can I get a dynamic path of type step?

    I solved Q1 for myself by using the mapping tab of the parameter within the configuration to the default module window.

    Everyone knows Q2?

    Thank you.

  • Change the parameter value in RTF model

    Hello
    Sorry if possible change a setting value of RTF model?
    Thank you for the ideas!

    Why can't use you the variable xdoxslt changed for her?
    Initialize the variable with a value of parameter.
    Reset the condition variable and use it.

  • How the parameter values can be passed to OBIEE reports of the user interface

    Hello

    Does anyone have an idea on how to pass parameters to the UI (user interface of a java application) to
    OBIEE report page. Based on the value of the parameter passed, the report page should be displayed for ex: the product
    name must be selected in the user interface, then the page of the report must show sales for this product
    Alone.can u please let me know how this can be achieved. Any help would be appreciated.

    Thank you
    Leela

    Hi Leela,
    What you're looking for can be accomplished with GO URL, see here:
    http://download.Oracle.com/docs/CD/E12096_01/books/AnyWebAdm/AnyWebAdm_APIWebIntegrate6.html#wp1005251

    Kind regards
    Alastair

    Published by: AlastairB_UK on October 26, 2009 15:27

  • Boolean 'and' 'or' interpretation of the parameter values

    It seems that when you enter a value in the parameter field, it is interpreted as a Boolean expression. For example, if the user enters "Analyst" in a parameter field, Pub BI deals "or" at the end of the main as a Boolean 'or '. For some reason, it does not, and then the defaultvalue is substituted for the value of the parameter. The same problem occurs with words that end with 'and '.

    I've created a minimum report using the following datatemplate to illustrate this problem. The .rtf report itself includes a field for the parameter MyParm and the value of "sysdate" of the sql statement. When the user enters "Analyst" in the parameter, the report is generated with a ' *' according to the defaultValue specified in the data model rather the status of value "analyst."

    < name of dataTemplate = than one dataSourceRef 'DATA' = "OPTDev" >
    < Parameters >
    < = "MyParm" dataType = "character" defaultValue = parameter name "*" / >
    < / Parameter >
    < dataQuery >
    < SQLStatement instance name = 'MYSQL' >
    <! [CDATA]
    Select sysdate double
    []] >
    < / sqlStatement >
    < / dataQuery >
    < dataStructure >
    < name of group = "G_MYSQL" source = "MYSQL" >
    < element name = "sysdate" value = "sysdate" / >
    < / Group >
    < / dataStructure >
    < / dataTemplate >

    I use BI Publisher 10.1.3.4.

    Its a bug, reported to Oracle.

    If they find a GOLD or AND in the value of the parameter, they reject as invalid value, as they say, it could lead way for SQL injection.

    I would ask you to go to the support of Oracle or Log SR for that.

  • Where the parameter value RepriceOrderChainId as repriceOrder in ExpressCheckoutF

    Guys,

    Do you have any ideas on below concern. Please share with us.

    PurchaseProcessFormHandler is an abstract class.

    ATG OOTB:
    ExpressCheckoutFormHandler extends PurchaseProcessFormHandler {}
    handleExpressCheckout () {}
    runRepricingProcess();
    }
    }

    RepriceOrderChainId property has getters and setters to PurchaseProcessFormHandler.

    No RepriceOrderChainId value in the PurchaseProcessFormHandler and ExpressCheckoutFormHandler component.

    But when I logdebug, RepriceOrderChainId values shows "repriceOrder".
    Here, I have a problem where the RepriceOrderChainId value defined as repriceOrder in the flow of
    ExpressCheckoutFormHandler - > PurchaseProcessFormHandler.

    Thank you

    Yes, because PurchaseProcessFormHandler is initialized to repriceOrder of the PurchaseProcessConfiguration.repriceOrderChainId. This happens in his doStartService(). PurchaseProcessConfiguration is located in ExpressCheckoutFormHandler.properties

    If you want to change the mechanism, change it in PurchaseProcessConfiguration and it will reflect PurchaseProcessFormHandler and therefore ExpressCheckoutFormHandler.

    -Kiss

  • The CMYK values change between FH and Photoshop

    Hello

    I'm recreating a logo in FreeHand MX11 of a fact in Photoshop CS2, which is composed of PMS colors. Unfortunately, the original artist didn't leave notes about what PMS colors she used, but when I sample a color in P'shop, I get a PMS color (286 PC C100/M66/Y0/K2) it's a close match. Problem is when I assign that same color in FreeHand, even if the color has the same CMYK values, it looks much darker and not of the same color at all. When I copy and paste the image of FH in Photoshop and sample it, its values change to C100, M86, Y23, K9.

    I'm confused, how the two applications can have so much variation in the PMS color display? Y at - he adjustment of color management that I need trouble?

    Thanks for any help,
    Chris

    Christopher Christner says:

    > [...] but when I sample a color in P'shop, I get a PMS color that has a close
    > match. Problem is when I assign that same color in FreeHand, it looks great
    > darker and not the same color at all.

    What are your color management settings is FH? Are you on a PC or a Mac? Are
    using ColorSync?

    Take a look at color settings of Danny Whitehead to see a success
    the colors between Photoshop and FH management approach.

    http://www.bqprint.co.UK/otherstuff/cmsettingsosx.jpg

    Judy Arndt

  • Add the parameter value total page

    Hello
    I want to add a parameter of total pages value, possible? Thanks in advance.

    You can't do that.

  • How to find all the Subvi value changes to a control inside a cluster?

    I have a question I've had brewing for many years now, and as of today, this issue has become less philosophical for me now that I have a VI project with hundreds of screws in there to work through... If I have a cluster which is passed between/through several subVIs, is there a way to find all reads/writes to a particular control within this cluster? For example, if I use a global variable, I can find all the instances where this variable has been changed. Several times, a cluster is used to pass data instead of lots of global variables, but I know not anyway quickly find where specific parts of the latter are read or written in subVIs. Global variables becomes a headache when they are too many of them fly around, but I can't keep track of reads/writes in bunches without manually looking through a few screws hundreds that take in the cluster. Is there a function for this that I'm not aware of? I hope that this question/problem of logic. This may prompt a discussion of architecture, which I would be happy, because I will need to build projects of this scale in the future, but I think also completely stuck when the clusters are used (by me or others) to pass data autour. Thank you! John

    If you ungroup by name and bundle by name, just do a search for text to the name of the control.

  • How to pass the value entered for the parameter IN a function

    Hello
    I'm new to pl/sql programming.
    The function below is used inside a package and the package is called in visual studio.
    The function uses the input parameters 2.
    Out what "in_report_parameter_id" value comes through the application of service job processor.
    The second IN the parameter values are hard coded into the function.
    I am not able to understand this.
    If the values are hard coded, how to ensure that only the hard coded values are the right ones?
    Please could someone explain?
    I don't really have good idea on how to move the INPUT parameter to the function or procedure
    Is there any nice document that could give me good understanding about what are the ways or types we could transmit values to the input in the subprogrammes parameter?

    Thanks in advance.

    CREATE OR REPLACE FUNCTION get_class_text_str
    (
         in_report_parameter_id IN NUMBER,
         in_which                IN VARCHAR2 DEFAULT 'SELECT'
    )
    RETURN VARCHAR2
    IS
             end_text            VARCHAR2 (50)   := ''; 
             my_class_text_str  VARCHAR2(10000) := '';
             my_class_value_str VARCHAR2(10000) := '';
     
         CURSOR class_text(c_1_text VARCHAR2, c_2_text VARCHAR2) IS
         SELECT c_1_text || report_parameters.report_parameter_value 
                               || c_2_text
                               || report_parameters.report_parameter_value 
                               || '" '
          FROM report_parameters
         WHERE report_parameters.report_parameter_id     = 3690
           AND report_parameters.report_parameter_group  = 'CLASS'
           AND report_parameters.report_parameter_name   = 'CLASS'
     GROUP BY report_parameters.report_parameter_value
     ORDER BY CAST(report_parameters.report_parameter_value AS NUMBER);
     
    BEGIN
    
         IF (in_which = 'SUM') THEN     
      
              OPEN class_text ( 'SUM(NVL("Class ', '", 0)) "Class ' );
        
         ELSIF (in_which = 'PERC')THEN
      
              OPEN class_text ( 'ROUND((("Class ', '" / "Total") * 100), 2) "Class ' );
              end_text := ', DECODE("Total", -1, 0, 100) "Total" ';
        
         ELSE
      
              OPEN class_text ( 'SUM(DECODE(bin_id, ', ', bin_value, 0)) "Class ' );
        
         END IF;
     
         LOOP
              FETCH class_text INTO my_class_value_str;
              EXIT WHEN class_text%NOTFOUND;
     
              my_class_text_str := my_class_text_str || ', ' || my_class_value_str;
         END LOOP;
     
         CLOSE class_text;
      
         my_class_text_str := my_class_text_str || end_text;
     
         RETURN my_class_text_str;
         
    END get_class_text_str;
    /
    Published by: user10641405 on November 19, 2009 08:16

    Published by: user10641405 on November 19, 2009 08:30

    This is not a conception I would use, but should work if coded correctly. I would probably create a reference text cursor query and use a fetch of open and close.

    You have 2 input parameters, in_report_parameter_id and in_which. I could not find where in_report_parameter_id has been used in the program, but the value passed to in_which is used in the logic of the FI to decide on opening the cursor. After the cursor is opened lines are to be read and possibly the cursor is closed.

    The in_which values are compared to the are hard-coded. It is the programming interface to ensure that the values are the values and the measures taken are also correct. Your program is assuming that if the first 2 values are not met the third listed is the one you want.

    To pass values of entry in a procedure you simply provide the values as a literal or something like variable in the call,

    whatever := get_class_text_str(1,'SELECT');
    
  • Need to display negative amounts, amounts positive based on the value of the parameter.

    Hi all

    I have a requirement in rdf as follows:

    I have two or three lines of the SELECT statement. An amount column having both negative and and postivie values.

    Based on the value of the parameter I need to take these records.

    Say, if the value of the parameter = "Credit amount", then I have to choose the records, the amount column value is negative.

    If the value of the parameter = "Debit amounts" then I have to choose the records, which the column value is positive.

    If the parameter Value = "All", then I must take all records, including both positive and negative.

    Please suggest how to achieve this scenario.

    Thank you
    Abdul

    In your where clause to add the following
    and ((& paramètre = "Débit" et montant > 0) or)
    (& parameter = 'Crédit' and the amount<0)>
    (& parameter = 'All'))

    Hope that answers your question
    Sandeep Gandhi
    Independent consultant
    513-325-9026.

  • Pass the wildcard character in the parameter

    In a report Portal parameter, I would like to pass the character % of wild-card for large searches. for example, add %. but I'm getting page not found exception. the parameter value is passed in the right syntax I check the url. Is there something changed in 10.1.4 I need to set up in the report to enable this?

    Thank you.

    To use the wildcard character * % * in a URL for report portal settings, it must be coded and included in the URL as * 25% *.

  • Working with table gross typed the parameter of the procedure.

    I have a table defined as


    CREATE TABLE 'JOBS '.
    ("JOB_ID' VARCHAR2 (200 BYTE),
    'FUNCTION' RAW (16).
    NUMBER OF "MIN_SALARY."
    NUMBER OF "MAX_SALARY.
    )



    Defined as package

    create or replace package associative_array as
    type t_job_id is table of index jobs.job_id%type by pls_integer;
    type t_job_title is table of index jobs.job_title%type by pls_integer;
    type t_min_salary is table of index jobs.min_salary%type by pls_integer;
    type t_max_salary is table of index jobs.max_salary%type by pls_integer;

    procedure array_insert (p_job_id in t_job_id,
    p_job_title in t_job_title,
    p_min_salary in t_min_salary,
    p_max_salary to t_max_salary);
    end associative_array;
    /


    create or replace package body associative_array as
    procedure array_insert (p_job_id in t_job_id,
    p_job_title in t_job_title,
    p_min_salary in t_min_salary,
    p_max_salary to t_max_salary) is
    Start
    ForAll i in p_job_id.first... p_job_id. Last
    insert into jobs (job_id,
    function,
    min_salary,
    max_salary)
    values (p_job_id (i),
    p_job_title (i),
    p_min_salary (i),
    p_max_salary (i));
    end array_insert;
    end associative_array;
    /

    The client code is

    String s = "UserID = system; password = system; data source = ORCL; enlist = true; layout common = true ";

    create and open the connection object
    Con OracleConnection = new OracleConnection (constr.);
    con. Open();
    OracleCommand cmd = con. CreateCommand();
    cmd.CommandText = "associative_array.array_insert";
    cmd.CommandType = CommandType.StoredProcedure;

    create objects for each parameter setting
    OracleParameter p_job_id = new OracleParameter();
    OracleParameter p_job_title = new OracleParameter();
    OracleParameter p_min_salary = new OracleParameter();
    OracleParameter p_max_salary = new OracleParameter();

    set the type parameter for each parameter
    p_job_id. OracleDbType is OracleDbType.Varchar2.;
    p_job_title. OracleDbType = OracleDbType.Raw;
    p_min_salary. OracleDbType = OracleDbType.Decimal;
    p_max_salary. OracleDbType = OracleDbType.Decimal;

    Set the type of collection for each parameter
    p_job_id CollectionType in the Group OracleCollectionType.PLSQLAssociativeArray;
    p_job_title. CollectionType = OracleCollectionType.PLSQLAssociativeArray;
    p_min_salary. CollectionType = OracleCollectionType.PLSQLAssociativeArray;
    p_max_salary. CollectionType = OracleCollectionType.PLSQLAssociativeArray;

    Set the parameter values
    p_job_id. value = new string [3] {"IT_DBA", "IT_MAN", "IT_VP"};
    p_job_title. Value = new Guid [1] {Guid.NewGuid ()};
    p_min_salary. Value = new decimal [3] {8000, 12000, 18000};
    p_max_salary. Value = new decimal [3] {16000, 24000, 36000};

    set the size for each table
    p_job_id. size = 3;
    p_job_title. Size = 1;
    p_min_salary. Size = 3;
    p_max_salary. Size = 3;

    p_job_id. ParameterName = "p_job_id";
    p_min_salary. ParameterName = "p_min_salary";
    p_max_salary. ParameterName = "p_max_salary";
    p_job_title. ParameterName = "p_job_title";

    Add parameters to the collection of command objects
    cmd. Parameters.Add (p_job_id);
    cmd. Parameters.Add (p_job_title);
    cmd. Parameters.Add (p_min_salary);
    cmd. Parameters.Add (p_max_salary);

    BindByName. cmd = true;
    run the insert
    cmd ExecuteNonQuery());

    Error occurred during execution of the customer.

    Unhandled exception: System.ArgumentException: invalid parameter binding
    Parameter name: p_job_title
    at Oracle.DataAccess.Client.OracleParameter.GetBindingSize_Raw (Int32 idx)
    at Oracle.DataAccess.Client.OracleParameter.PreBind_Raw)
    to Oracle.DataAccess.Client.OracleParameter.PreBind (OracleConnection conn, IntPtr errCtx, Int32 arraySize)
    at Oracle.DataAccess.Client.OracleCommand.ExecuteNonQuery)

    But if I change jobs. P_job_title varchar2 and change function. Value and p_job_title. Therefore, any OracleDbType is fine.

    Following me is at fault-
    p_job_title. Value = new Guid [1] {Guid.NewGuid ()};

    Since you have already said-
    p_job_title. OracleDbType = OracleDbType.Raw;

    You must have 'p_job_title. Value' as 'Byte' or 'OracleBinary.

    It will be useful.

  • The default value for a property with data of type boolean

    Hi all

    Is it a system preference setting, where the default value for a property with data of type boolean can be a Virgin? I want to keep the value by default in a vacuum, but every time I save the property even after empty selection, the default value changes to FALSE.

    Capture.JPG

    In this case Boolean doesn't help you, you mayneed to create a chain of ownership and have true/false / "" as your list of values

Maybe you are looking for

  • Attach restrictions makes it unnecessary

    There is an IMPORTANT gap in the system Restrictions of Apple - tie. Any child smart enough to attach their phone to another device can bypass any restriction of site that have been put in place. Carries most refuses to disable the hotspot feature, l

  • Qosmio X 500-10T - integrated controller has failed

    : The embedded controller (EC) has failed in the specified time-out period. This may indicate that there is an error in the EC hardware or firmware or BIOS is accessing the EC incorrectly. You should check with the manufacturer of your computer for a

  • Setting the resolution for S1931 LCD screens

    Installed S1931 monitor has a maximum resolution of 1366 X 768 at 60 hz.  My XP system will be higher in 1024 X 768.  Image is stretched and round objects are oval.  Is it possible to improve the resolution? Or is it not compatible with my computer?

  • Documents appear suspended in the spooler.

    When printing, all documents for all printers show paused in the spooler on Vista PC. Need to go in the spooler and return the documents to print. Vista 32 SP2 and HP and Epson printers running. Removed all of the printers 'Printers' in Vista, re-ins

  • I have a hp pavilion dv9205us laptop - Alt print screen does not work

    I have a hp pavilion dv9205us laptop - Alt Print screen (single screen) does not work - operating sys is Vista but XP Professional is my Microsoft application - I can Alt scree printing when I have a keyboard plugged in. - but without the HP laptop h