Class PlsqlIndexByTable2
- All Implemented Interfaces:
PlsqlArray
This class represents an Oracle PL/SQL Index By Table. In addition to the table data it also holds information about the data type of the elements in the table, their maximum length and the maximum number of elements this table can have after an update or retrieval. For this reason this class is always instantiated even for OUT parameters. As of Oracle 10g INDEX BY tables can have two types of parameters - Numbers or Strings. Parameter types can not be mixed within the same table. MCPDBWizard converts other data types to numbers or strings.
Under normal circumstances MCPDBWizard users will have no reason to use this class directly - the generated code will use it.
Copyright 2003-2026 ATB Consultancy Services Ltd (formerly Orinda Software Ltd, Dublin, Ireland)
- Since:
- Oracle 10g/5.0.2556
- Version:
- 7
- Author:
- devteam@mcpdbwizard.com
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionPlsqlIndexByTable2(int realDataTypeCode, int realDataTypePrecision) Contruct an empty INDEX BY table -
Method Summary
Modifier and TypeMethodDescriptionObject[]getArray()Get the array dataGet the array data as java.math.BigDecimal[] This convenience method returns the contents of the array as an array of BigDecimal.double[]getArrayAsDouble(double nullToken) Get the array data as double[] This convenience method returns the contents of the array as an array of double.Double[]Get the array data as Double[] This convenience method returns the contents of the array as an array of BigDecimal.float[]getArrayAsFloat(float nullToken) Get the array data as float[] This convenience method returns the contents of the array as an array of float.Float[]Get the array data as Float[] This convenience method returns the contents of the array as an array of BigDecimal.int[]getArrayAsInt(int nullToken) Get the array data as int[] This convenience method returns the contents of the array as an array of int.Integer[]Get the array data as Integer[] This convenience method returns the contents of the array as an array of BigDecimal.long[]getArrayAsLong(long nullToken) Get the array data as long[] This convenience method returns the contents of the array as an array of long.Long[]Get the array data as Long[] This convenience method returns the contents of the array as an array of BigDecimal.byte[][]Get the array data as byte[] This convenience method returns the contents of the array as an array of byte[].String[]Get the array data as String[] This convenience method returns the contents of the array as an array of String.Get the array data as java.sql.Timestamp This convenience method returns the contents of the array as an array of java.sql.Timestamp.intGet the length of the arrayAn index-by table has no SQL type name -- it exists only inside PL/SQL and is bound element-wise, never as a named collection -- so there is no name to return.Object[]getCurrentValuesAsObject(Connection theConnection) The current contents.intGet the official OracleType code for the array.intGet the maximum size this table can be after an update or retrieval.intGet the maximum length of an element in the tableintGet the actual OracleType code for the array.voidsetArray(byte[][] newArray) Set the array data using byte[][] This convenience method returns sets the array using an array of byte[][]voidsetArray(double[] newArray) Set the array data using double[] This convenience method returns sets the array using an array of double[] WARNING: The precision of the value actually stored is limited to what the underlying Oracle object expects, so if you pass 1.00003f into a NUMBER(4,2) the '3' will be lostvoidsetArray(float[] newArray) Set the array data using float[] This convenience method returns sets the array using an array of float[] WARNING: The precision of the value actually stored is limited to what the underlying Oracle object expects, so if you pass 1.00003f into a NUMBER(4,2) the '3' will be lostvoidsetArray(int[] newArray) Set the array data using int[] This convenience method sets the array using an array of int[]voidsetArray(long[] newArray) Set the array data using long[] This convenience method returns sets the array using an array of long[]voidSet the array data using Double[] This convenience method returns sets the array using an array of Double[] WARNING: The precision of the value actually stored is limited to what the underlying Oracle object expects, so if you pass 1.00003f into a NUMBER(4,2) the '3' will be lostvoidSet the array data using Float[] This convenience method returns sets the array using an array of Float[] WARNING: The precision of the value actually stored is limited to what the underlying Oracle object expects, so if you pass 1.00003f into a NUMBER(4,2) the '3' will be lostvoidSet the array data using Integer[] This convenience method returns sets the array using an array of Integer[] WARNING: The precision of the value actually stored is limited to what the underlying Oracle object expects, so if you pass 1.00003f into a NUMBER(4,2) the '3' will be lostvoidSet the array data using Long[] This convenience method returns sets the array using an array of Long[] WARNING: The precision of the value actually stored is limited to what the underlying Oracle object expects, so if you pass 1.00003f into a NUMBER(4,2) the '3' will be lostvoidSet the contents of the Array.voidSet the array data using java.sql.Timestamp[] This convenience method returns sets the array using an array of java.sql.Timestamp[]voidsetDataType(int dataTypeCode) Set the official Oracle data typevoidsetElementMaxCount(int elementMaxCount) Set the maximum size this table can be after an update or retrieval.voidsetElementMaxLength(int elementMaxLength) Set the maximum length of an element in the tablevoidsetNewValuesAsObject(Object[] newValues) Replace the contents from a genericObject[], asPlsqlArrayrequires.voidsetRealDataType(int realDataTypeCode) Set the actual Oracle data type
-
Field Details
-
ORACLE_TIMESTAMP_TO_CHAR_MASK
Date format mask used by Oracle for converting timestamp to String- See Also:
-
ORACLE_DATE_TO_CHAR_MASK
Date format mask used by Oracle for converting date to String- See Also:
-
JAVA_DATE_TO_CHAR_MASK
Date format mask used by Java for converting Timestamp to String- See Also:
-
-
Constructor Details
-
PlsqlIndexByTable2
public PlsqlIndexByTable2(int realDataTypeCode, int realDataTypePrecision) Contruct an empty INDEX BY table- Parameters:
realDataTypeCode- One of oracle.jdbc.OracleTypes.NUMBER or oracle.jdbc.OracleTypes.VARCHARrealDataTypePrecision- How many decimal places of precision.
-
-
Method Details
-
getDataTypeCode
public int getDataTypeCode()Get the official OracleType code for the array. -
getRealDataTypeCode
public int getRealDataTypeCode()Get the actual OracleType code for the array. -
setDataType
public void setDataType(int dataTypeCode) Set the official Oracle data type -
setRealDataType
public void setRealDataType(int realDataTypeCode) Set the actual Oracle data type -
getElementMaxLength
public int getElementMaxLength()Get the maximum length of an element in the table -
setElementMaxLength
public void setElementMaxLength(int elementMaxLength) Set the maximum length of an element in the table -
getElementMaxCount
public int getElementMaxCount()Get the maximum size this table can be after an update or retrieval. -
setElementMaxCount
public void setElementMaxCount(int elementMaxCount) Set the maximum size this table can be after an update or retrieval. This is used to decide how big the output array should be. -
getArray
Get the array data -
setNewValuesAsObject
Replace the contents from a genericObject[], asPlsqlArrayrequires.Delegates to
setArray(Object[]), which coerces each element toStringorBigDecimalaccording torealDataTypeCode-- so the type code passed to the constructor decides how the values are interpreted, exactly as for every other entry point on this class.- Specified by:
setNewValuesAsObjectin interfacePlsqlArray- Parameters:
newValues- an array of Object- Throws:
CSException- when array is not usable or is not composed of Object
-
getCurrentValuesAsObject
The current contents. TheConnectionargument is part of thePlsqlArraycontract because a generated collection class may need to talk to the database to resolve its SQL type; an index-by table is a purely client-side PL/SQL construct with no SQL type of its own, so the argument is deliberately ignored and may be null.- Specified by:
getCurrentValuesAsObjectin interfacePlsqlArray- Parameters:
theConnection- - only used when working with STRUCT.- Returns:
- Object[]
-
getArrayName
An index-by table has no SQL type name -- it exists only inside PL/SQL and is bound element-wise, never as a named collection -- so there is no name to return. ThePlsqlArraycontract needs the method; callers that key off the name should treat empty as "not a named SQL collection".- Specified by:
getArrayNamein interfacePlsqlArray- Returns:
- String The Array Name.
-
setArray
Set the contents of the Array. This method assumes that the user is providing a 1 dimensional array of numbers or strings. The values of elementMaxCount and elementMaxLength are updated by this method. If you are passing in an array that will be appended and returned to you you should call setElementMaxCount and setElementMaxLength after calling setArray. 'null' is not an acceptable value for dataArray and will be turned into Object[0]. This is so that getArrayLength works reliably.- Parameters:
newDataArray-- See Also:
-
setArray
public void setArray(int[] newArray) Set the array data using int[] This convenience method sets the array using an array of int[]- Parameters:
newArray-
-
setArray
Set the array data using Integer[] This convenience method returns sets the array using an array of Integer[] WARNING: The precision of the value actually stored is limited to what the underlying Oracle object expects, so if you pass 1.00003f into a NUMBER(4,2) the '3' will be lost- Parameters:
newArray-
-
setArray
public void setArray(long[] newArray) Set the array data using long[] This convenience method returns sets the array using an array of long[]- Parameters:
newArray-
-
setArray
Set the array data using Long[] This convenience method returns sets the array using an array of Long[] WARNING: The precision of the value actually stored is limited to what the underlying Oracle object expects, so if you pass 1.00003f into a NUMBER(4,2) the '3' will be lost- Parameters:
newArray-
-
setArray
public void setArray(float[] newArray) Set the array data using float[] This convenience method returns sets the array using an array of float[] WARNING: The precision of the value actually stored is limited to what the underlying Oracle object expects, so if you pass 1.00003f into a NUMBER(4,2) the '3' will be lost- Parameters:
newArray-
-
setArray
Set the array data using Float[] This convenience method returns sets the array using an array of Float[] WARNING: The precision of the value actually stored is limited to what the underlying Oracle object expects, so if you pass 1.00003f into a NUMBER(4,2) the '3' will be lost- Parameters:
newArray-
-
setArray
public void setArray(double[] newArray) Set the array data using double[] This convenience method returns sets the array using an array of double[] WARNING: The precision of the value actually stored is limited to what the underlying Oracle object expects, so if you pass 1.00003f into a NUMBER(4,2) the '3' will be lost- Parameters:
newArray-
-
setArray
Set the array data using Double[] This convenience method returns sets the array using an array of Double[] WARNING: The precision of the value actually stored is limited to what the underlying Oracle object expects, so if you pass 1.00003f into a NUMBER(4,2) the '3' will be lost- Parameters:
newArray-
-
setArray
Set the array data using java.sql.Timestamp[] This convenience method returns sets the array using an array of java.sql.Timestamp[]- Parameters:
newArray-- Throws:
CSNoNanosAllowedException- when nanoseconds provided for an Oracle DATE field
-
setArray
public void setArray(byte[][] newArray) Set the array data using byte[][] This convenience method returns sets the array using an array of byte[][]- Parameters:
newArray-
-
getArrayAsInt
Get the array data as int[] This convenience method returns the contents of the array as an array of int. Because the array can have null elements and an 'int' can never be null you need to say how nulls should be treated.- Parameters:
nullToken- The int you will use to represent null. e.g. Integer.MIN_VALUE- Returns:
- int[] An array of numbers. If the array is empty you will get int[0] back.
- Throws:
ClassCastException- if the array isn't of numbers.CSNumberFormatException- if the array cant be turned into int.
-
getArrayAsLong
Get the array data as long[] This convenience method returns the contents of the array as an array of long. Because the array can have null elements and a 'long' can never be null you need to say how nulls should be treated.- Parameters:
nullToken- The long you will use to represent null. e.g. Long.MIN_VALUE- Returns:
- long[] An array of numbers. If the array is empty you will get long[0] back.
- Throws:
ClassCastException- if the array isn't of numbers.CSNumberFormatException
-
getArrayAsFloat
Get the array data as float[] This convenience method returns the contents of the array as an array of float. Because the array can have null elements and a 'float' can never be null you need to say how nulls should be treated.- Parameters:
nullToken- The float you will use to represent null. e.g. Float.MIN_VALUE- Returns:
- float[] An array of numbers. If the array is empty you will get float[0] back.
- Throws:
ClassCastException- if the array isn't of numbers.CSNumberFormatException
-
getArrayAsDouble
Get the array data as double[] This convenience method returns the contents of the array as an array of double. Because the array can have null elements and a 'double' can never be null you need to say how nulls should be treated.- Parameters:
nullToken- The double you will use to represent null. e.g. Double.MIN_VALUE- Returns:
- double[] An array of numbers. If the array is empty you will get double[0] back.
- Throws:
ClassCastException- if the array isn't of numbers.CSNumberFormatException
-
getArrayAsString
Get the array data as String[] This convenience method returns the contents of the array as an array of String. Because the array can have null elements and an 'double' can never be null you need to say how nulls should be treated.- Returns:
- String[] An array of Strings. If the array is empty you will get double[0] back.
-
getArrayAsBigDecimal
Get the array data as java.math.BigDecimal[] This convenience method returns the contents of the array as an array of BigDecimal.- Returns:
- BigDecimal[] An array of BigDecimal
- Throws:
CSNumberFormatException- if this isn't an array of numbers- Since:
- 4.0.2108
-
getArrayAsDoubleObject
Get the array data as Double[] This convenience method returns the contents of the array as an array of BigDecimal.- Returns:
- Double[] An array Double
- Throws:
CSNumberFormatException- if this isn't an array of numbers- Since:
- 4.0.2108
-
getArrayAsFloatObject
Get the array data as Float[] This convenience method returns the contents of the array as an array of BigDecimal.- Returns:
- Float[] An array of Float
- Throws:
CSNumberFormatException- if this isn't an array of numbers- Since:
- 4.0.2108
-
getArrayAsIntegerObject
Get the array data as Integer[] This convenience method returns the contents of the array as an array of BigDecimal.- Returns:
- Integer[] An array of Integer
- Throws:
CSNumberFormatException- if this isn't an array of numbers- Since:
- 4.0.2108
-
getArrayAsLongObject
Get the array data as Long[] This convenience method returns the contents of the array as an array of BigDecimal.- Returns:
- Long[] An array of Long
- Throws:
CSNumberFormatException- if this isn't an array of numbers- Since:
- 4.0.2108
-
getArrayAsTimestamp
Get the array data as java.sql.Timestamp This convenience method returns the contents of the array as an array of java.sql.Timestamp.- Returns:
- java.sql.Timestamp[] An array of numbers. If the array is empty you will get java.sql.Timestamp[0] back.
- Throws:
ClassCastException- if the array isn't of Strings.CSException
-
getArrayAsRaw
public byte[][] getArrayAsRaw()Get the array data as byte[] This convenience method returns the contents of the array as an array of byte[].- Returns:
- byte[][] An array of numbers. If the array is empty you will get byte[][0] back.
- Throws:
ClassCastException- if the array isn't of numbers.
-
getArrayLength
public int getArrayLength()Get the length of the array
-