Hashtable equalent data type in PLSQL

Hi,
From java i am calling stored procedure, i want to pass hashtable to it.Data in hashtable consists of key and value. Key is some integer and value is an Object[](array)
So i want to know datatype equal to Hashtable in PLSQL.
Can anyone help out in solving about problem.
--Kalyan

Look Associative Arrays (Index-By Tables) :
create or replace package Kalyan
IS
type t1 is record (empno number, ename varchar2(200), hiredate date,....);
type t2 is table of t1 index by binary_integer;
procedure f1(par1 in out t2);
end;

Similar Messages

  • SQL types over PLSQL types while using Oracle Applications adapter in BPEL

    Use SQL types over PL/SQL types while using Oracle Applications adapter
    in BPEL/ ESB
    This document will be focusing on Oracle Applications adapter. However Database adapter is much like OA adapter (even OA adapter uses DB Adapter), so the readers who are interested to explore DB adapters, can relate things with this document and go further as well.
    Some Guidelines for writing PL/SQL APIs for OA Adapter
    As we know when we create a partner link from the OA adapter wizard it sometimes writes some wrapper script supportive to the OA Adapter WSDL which contains below
    * Object type for PL/SQL RECORD
    * Nested table of the given type for PL/SQL TABLE. For example, the nested table of NUMBER.
    * INTEGER substituted for PL/SQL BOOLEAN
    * Wrapper Script for converting above three set of data types . (PLSQL to SQL and SQL to PLSQL conversion functions)
    In runtime this wrapper script for converting PL/SQL to SQL and SQL to PL/SQL is an extra overhead.
    So the first advice would be to avoid the use of the below as parameters of PLSQL API being called by OA Adapter.
    * PL/SQL RECORD
    * PL/SQL TABLE. For example, the nested table of NUMBER.
    * PL/SQL BOOLEAN
    In other way we can say we should try to use only SQL data types in arguments if we are planning to call any PL/SQL API from the OA Adapter.
    If the requirement is to use a table or record uses the Object type. In place of BOOLEAN better to use VARCHAR or INTEGER what ever fulfills your requirement. Following this guideline we can reduce a huge number of Line of codes to be run each time the adapter being called.
    Generally, Oracle E-Biz standard APIs use PL/SQL record types and table types so when there is a requirement to call these API’s from OA Adapter (this is a common requirement in development), and if we directly browse the API in OA Adapter Configuration Wizard and create the partner link, again a huge number of code is written by the wizard in the wrapper script (a number of extra mapping of fields which are not being used in the interface).
    In this case better would be to create an Object type with only the required fields which are being used in that call and use them as parameters for the PLSQL API.

    Find the complete document
    http://www.4shared.com/file/167171882/29525116/Use_SQL_types_over_PLSQL_types.html

  • How to call user define data type as data type for concurrent parameter

    Hi All,
    i find some difficulty while creating the concurrent program.
    i.e.
    i have one of the parameter of table type i.e. user define data type at PLSql program
    now i need to register same PLSQL program into oracle applications as concurrent program
    but while i am creating Parameters for concurrent program
    How could i define that user define data type at database level in oracle applications using 'Value set' ?
    any one save me from this Problem
    thanks and Regards,
    sai krishna@cavaya.

    Don't think this can be done..
    One way I can think of is to wrap your PL/SQL program under another procedure/package that can accept "normal" parameter,and use/register this wrapper instead of your original pl/sql program.
    HTH

  • Type of X equals which data elements or data type

    Hi ABAP Experts,
    I declareted variable type of X in my program.
    (Example TYPES: BEGIN OF T_XML_LINE,
             DATA(1024) TYPE X,
           END OF T_XML_LINE.)
    But I want to create structure with SE11 Tcode in my program. But I dont know Type of X equals which data elements or data type and length.
    Thanks for help.

    Hi,
    You can use the below data type in data dictionary
    RAW:   Uninterpreted byte string, maximum length of 255 in tables
    LRAW: Uninterpreted byte string of any length, but has to be declared with a minimum length of 256
    RAWSTRING: Uninterpreted byte string of variable length
    Regards
    Praveen

  • Equals(=) vs. LIKE for date data type

    First, I'm aware that the equals (=) operator is a "comparison operator compares two values for equality."  In other words, in an SQL statement, it won't return true unless both sides of the equation are equal.  For example:
    SELECT * FROM Store WHERE Quantity = 200;
    The LIKE operator "implements a pattern match comparison" that attempts to match "a string value against a pattern string containing wild-card characters."  For example:
    SELECT * FROM Employees WHERE Name LIKE 'Chris%';
    Here,
    I query about date type data on ORACLE database, I found the following, when I write select statment in this way:
    SELECT ACCOUNT.ACCOUNT_ID, ACCOUNT.LAST_TRANSACTION_DATE FROM ACCOUNT WHERE ACCOUNT.LAST_TRANSACTION_DATE LIKE '30-JUL-07';
    I get all rows I'm looking for. but when I use the sign equal = instead :
    SELECT ACCOUNT.ACCOUNT_ID, ACCOUNT.LAST_TRANSACTION_DATE FROM ACCOUNT WHERE ACCOUNT.LAST_TRANSACTION_DATE = '30-JUL-07';
    I get nothing even though nothing is different except the equal sign. Can I find any explanation for this please ?

    You are relying on implicit datatype conversions between DATE and VARCHAR2.  This is not only bad practice but it's unreliable as it depends on NLS_DATE_FORMAT parameter settings.
    My NLS_DATE_FORMAT parameter is different from yours, so if I do the same sort of test...
    SQL> select * from emp;
         EMPNO ENAME      JOB              MGR HIREDATE                    SAL       COMM     DEPTNO
          7369 SMITH      CLERK           7902 17-DEC-1980 00:00:00        800                    20
          7499 ALLEN      SALESMAN        7698 20-FEB-1981 00:00:00       1600        300         30
          7521 WARD       SALESMAN        7698 22-FEB-1981 00:00:00       1250        500         30
          7566 JONES      MANAGER         7839 02-APR-1981 00:00:00       2975                    20
          7654 MARTIN     SALESMAN        7698 28-SEP-1981 00:00:00       1250       1400         30
          7698 BLAKE      MANAGER         7839 01-MAY-1981 00:00:00       2850                    30
          7782 CLARK      MANAGER         7839 09-JUN-1981 00:00:00       2450                    10
          7788 SCOTT      ANALYST         7566 19-APR-1987 00:00:00       3000                    20
          7839 KING       PRESIDENT            17-NOV-1981 00:00:00       5000                    10
          7844 TURNER     SALESMAN        7698 08-SEP-1981 00:00:00       1500          0         30
          7876 ADAMS      CLERK           7788 23-MAY-1987 00:00:00       1100                    20
          7900 JAMES      CLERK           7698 03-DEC-1981 00:00:00        950                    30
          7902 FORD       ANALYST         7566 03-DEC-1981 00:00:00       3000                    20
          7934 MILLER     CLERK           7782 23-JAN-1982 00:00:00       1300                    10
    14 rows selected.
    SQL> select * from emp where hiredate like '19-APR-87';
    no rows selected
    SQL> select * from emp where hiredate = '19-APR-87';
    no rows selected
    The LIKE operator is intended to be used for strings... DON'T attempt to use them on dates, and remember when you specify dates that you need to use TO_DATE (or the DATE internal format) to convert your string to DATE datatype
    e.g.
    SQL> select * from emp where hiredate = date '1987-04-19';
         EMPNO ENAME      JOB              MGR HIREDATE                    SAL       COMM     DEPTNO
          7788 SCOTT      ANALYST         7566 19-APR-1987 00:00:00       3000                    20

  • Data Type for Process Flow... PB with Date?

    I've got a problem by passing parameters in process flow.
    I have a mapping with a parameter DATE_EXEC (data type : DATE) and a default value that is TO_DATE('20/01/2007' , 'dd/mm/yyyy') . My mapping is working good when i launch it.
    I have a process flow which contains the mapping. This process has a parameter DATE_EXEC (data type : DATE). I bind the 2 DATE_EXEC. But when i launch my mapping the value is not recognized, I try with :
    - TO_DATE('20/01/2007' , 'dd/mm/yyyy')
    - 20/01/2007
    - 2007.01.20
    - 2007-01-20
    My question is what are the data type in process flow? They are not ORACLE TYPE.
    For example , a parameter in a mapping which is a VARCHAR2 must be input between quotes but if you bind it to a parameter of a process flow which is a STRING (not ORACLE Data type) , you must input it without quotes?
    Anybody has some rules about that?
    I apologize for my english, i'm a french people.

    Here is some information on the literal quote or not quote query and what I think you need to do at the end, hope it helps. Not exactly intuitive...since the flow designer (you) have to know what is a PLSQL object and what is not.
    1. Literal = FALSE
    When Literal = FALSE is set then the value entered must be a valid PL/SQL expression which is evaluated at the Control Center e.g.
    'Hello World!'
    22 / 7
    2. Literal = TRUE
    When Literal = TRUE then the value is dependent on the the type of Activity. If the activity is a PL/SQL object i.e. Mapping or Transformation, then the value is PL/SQL snippet. The critical difference here is that the value is macro substituted into the call for the object. The format of the value is identical to that entered as default value in the Mapping editor. e.g.
    'Hello World!'
    sysdate()
    If the activity type is not a PL/SQL object then the value is language independent. e.g.
    Hello World
    3.1427571
    What you should try......
    Check the map activity parameter in your process flow to see if literal is false (an expression), set it to false and then try using your TO_DATE('20/01/2007' , 'dd/mm/yyyy') expression, deploy your flow and execute. Alternatively the user guide defines the DATE type for flow with the format YYYY-MM-DD so you can have the parameter value as '2007-01-20' use literal equal to true and remember and quote your value.
    Cheers
    David

  • Using DBMS_DATAPUMP with LONG data type

    I've got a procedure below that calls the DBMS_DATAPUMP procedure using a REMOTE_LINK to move a schema from one database to another. However, a couple of the tables within that schema have columns with the LONG data type. And when I run it I get an error saying that you cannot move data with the LONG data type using a REMOTE LINK. So no data in those particular tables gets moved over.
    Has anyone else had this issue? If so, do you have a work around? I tried adding a CLOB column to my table and setting the new CLOB to equal the LONG, but I couldn't get that to work either...even when I tried using a TO_LOB. If I could get that to, then I could just drop the LONG, move the schema, then recreate the LONG column on the opposite side.
    Here's my procedure....
    DECLARE
         /* EXPORT/IMPORT VARIABLES */
         v_dp_job_handle                    NUMBER ;          -- Data Pump job handle
         v_count                              NUMBER ;          -- Loop index
         v_percent_done                    NUMBER ;          -- Percentage of job complete
         v_job_state                         VARCHAR2(30) ;     -- To keep track of job state
         v_message                         KU$_LOGENTRY ;     -- For WIP and error messages
         v_job_status                    KU$_JOBSTATUS ;     -- The job status from get_status
         v_status                         KU$_STATUS ;     -- The status object returned by get_status
         v_logfile                         NUMBER ;
         v_date                              VARCHAR2(13) ;
         v_source_server_name          VARCHAR2(50) ;
         v_destination_server_name     VARCHAR2(50) ;
    BEGIN
         v_project := 'TEST' ;
         v_date := TO_CHAR(SYSDATE, 'MMDDYYYY_HHMI') ;
         v_source_server_name := 'TEST_DB' ;
         v_dp_job_handle := DBMS_DATAPUMP.OPEN(
              OPERATION     => 'IMPORT',
              JOB_MODE     => 'SCHEMA',
              REMOTE_LINK => v_source_server_name,
              JOB_NAME     => v_project||'_EXP_'||v_date,
              VERSION          => 'LATEST') ;
         v_logfile := DBMS_DATAPUMP.KU$_FILE_TYPE_LOG_FILE ;
         DBMS_DATAPUMP.ADD_FILE(
              HANDLE          => v_dp_job_handle,
              FILENAME     => v_project||'_EXP_'||v_date||'.LOG',
              DIRECTORY     => 'DATAPUMP',
              FILETYPE     => v_logfile) ;
         DBMS_DATAPUMP.METADATA_FILTER(
              HANDLE          => v_dp_job_handle,
              NAME          => 'SCHEMA_EXPR',
              VALUE          => '= '''||v_project||''' ') ;
         DBMS_DATAPUMP.START_JOB(v_dp_job_handle) ;
         v_percent_done := 0 ;
         v_job_state := 'UNDEFINED' ;
         WHILE (v_job_state != 'COMPLETED') AND (v_job_state != 'STOPPED')
         LOOP
              DBMS_DATAPUMP.GET_STATUS(
                   v_dp_job_handle,
                   DBMS_DATAPUMP.KU$_STATUS_JOB_ERROR + DBMS_DATAPUMP.KU$_STATUS_JOB_STATUS + DBMS_DATAPUMP.KU$_STATUS_WIP,
                   -1,
                   v_job_state,
                   v_status) ;
                   v_job_status := v_status.JOB_STATUS ;
              IF v_job_status.PERCENT_DONE != v_percent_done THEN
                   DBMS_OUTPUT.PUT_LINE('*** Job percent done = '||TO_CHAR(v_job_status.PERCENT_DONE)) ;
                   v_percent_done := v_job_status.PERCENT_DONE ;
              END IF ;
              IF BITAND(v_status.MASK, DBMS_DATAPUMP.KU$_STATUS_WIP) != 0 THEN
                   v_message := v_status.WIP ;
              ELSIF BITAND(v_status.mask, DBMS_DATAPUMP.KU$_STATUS_JOB_ERROR) != 0 THEN
                   v_message := v_status.ERROR ;
              ELSE
                   v_message := NULL ;
              END IF ;
              IF v_message IS NOT NULL THEN
                   v_count := v_message.FIRST ;
                   WHILE v_count IS NOT NULL
                   LOOP
                        DBMS_OUTPUT.PUT_LINE(v_message(v_count).LOGTEXT) ;
                        v_count := v_message.NEXT(v_count) ;
                   END LOOP ;
              END IF ;
         END LOOP ;
         DBMS_OUTPUT.PUT_LINE('Job has completed') ;
         DBMS_OUTPUT.PUT_LINE('Final job state = '||v_job_state) ;
         DBMS_DATAPUMP.DETACH(v_dp_job_handle) ;
    END ;

    But the application we have that uses the database cannot be changed to read from a CLOBWhy can't you change the application?
    Well, anyway you should point out to your superiors that Oracle documented years ago to not use LONGS anymore...
    http://download.oracle.com/docs/cd/B19306_01/server.102/b14220/datatype.htm#sthref3806
    It clearly states:
    LONG Datatype
    Note:
    Do not create tables with LONG columns. Use LOB columns (CLOB, NCLOB) instead. LONG columns are supported only for backward compatibility.
    Oracle also recommends that you convert existing LONG columns to LOB columns. LOB columns are subject to far fewer restrictions than LONG columns. Further, LOB functionality is enhanced in every release, whereas LONG functionality has been static for several releases.
    How do I go from CLOB to LONG?I'm sorry, cannot help you on that one, I don't think you can do that at all (Oracle wants us to stop using LONGS, so, it's a one-way conversion...):
    http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:1037232794454#15512131314505
    So: NO built_in, you'll need to write a program if the clob is ALWAYS LESS THAN 32k in size, you can use plsql..but is that the case in your case? Only you know that.
    I believe that question is still unanswered on this forum, but you might try searchin for answers on this forum, and
    the 'Database-General' forum: General Database Discussions
    Perhaps you can google a Q&D workaround...
    ( And consider convincing your collegues to just convert your LONGS to LOBS)
    Edited by: hoek on Apr 8, 2009 5:43 PM

  • Arrays of Different Data Types

    Hi, I am studing Java Development as 2 of my units (Programming Theory and Programming Practice), and I have a problem with a program which involves an array that contains two data types; int and long. The program is designed to store Student ID's and Exam Marks (1 Exam Mark per ID). The program is designed to use sorting, and the array is to be populated at the start of program execution. It compiles fine, but I get an error when the program is running as soon as you input the first value. The program is not very complex, but I need to understand how to get this fixed and why is isn't already. Any help is appreciated as this is a genuine problem. This program follows a consistent style template given to me by my tutor. The source is given below, and I appreciate any positive response.
    Thanks in advance...
    Aaron
         Name: Aaron Allport ([email protected])
         Assignment Number: 7
         Program Title/Topic: Student Marks/ID's with use of Array's
         Program Description: Using arrays and search/sort methods,
                                  write a program that keeps a record of
                                  students on a module, and allows the
                                  data to be manipulated.
         Course Title/Unit: BTEC National in Computing
    import javax.swing.JOptionPane;
    class StudentRecord
         int mark;
         long sID;
    public class Assignment7
         public static void main(String args[])
              final int numOfStudents = 11;
              String highestMark;
              String lowestMark;
              String examMark;
              long studentID = 00000000;
              String menuChoice;
              StudentRecord module[] = new StudentRecord[numOfStudents];
              inputRecords(module, numOfStudents);
              do
              menuChoice = JOptionPane.showInputDialog(null,
                   "STUDENT MODULE MARKS\n\n" +
                   "1. Find student with highest mark\n" +
                   "2. Find student with lowest mark\n" +
                   "3. Find grade for a given student\n" +
                   "4. Sort records by Student ID\n" +
                   "5. Sort records by Student Mark\n" +
                   "6. Display all records");
                        if (menuChoice.equals("1"))
                             highestMark = findHighest(module, numOfStudents);
                        else if (menuChoice.equals("2"))
                             lowestMark = findLowest(module, numOfStudents);
                        else if (menuChoice.equals("3"))
                             examMark = findGrade(module, numOfStudents, studentID);
                        else if (menuChoice.equals("4"))
                             studentIDSort(module, numOfStudents);
                             displayData(module, numOfStudents);
                        else if (menuChoice.equals("5"))
                             markSort(module, numOfStudents);
                             displayData(module, numOfStudents);
                        else if (menuChoice.equals("6"))
                             displayData(module, numOfStudents);
                   } while (menuChoice.equalsIgnoreCase("Q") == false);     
                   System.exit(0);
         public static void inputRecords(StudentRecord module[], int numOfStudents)
              int i;
              String inputMark;
              String inputStudentID;
              for (i = 1; i < numOfStudents; i++)
                   module[ i] = new StudentRecord();
                   inputStudentID = JOptionPane.showInputDialog(null,
                                       "Please enter Student ID for position " + i + ":");
                   module[ i].sID = Long.parseLong(inputStudentID);
                   inputMark = JOptionPane.showInputDialog(null,
                                       "Please enter Student Mark for position " + i + ":");
                   module[ i].mark = Integer.parseInt(inputMark);
         public static String findHighest(StudentRecord module[], int numOfStudents)
              int highStudentID;
              int j;
              StudentRecord temp = new StudentRecord();
              boolean intChange = true;
              int pass = 1;
              String outputMark;
              String outputSID;
              while((pass <= numOfStudents - 1) && (intChange))
                   intChange = false;
                   for (j = 1; j <= numOfStudents - pass; j++)
                        module[j] = new StudentRecord();
                        if(module[j].mark > module[j + 1].mark)
                             intChange = true;
                             temp.mark = module[j].mark;
                             temp.sID = module[j].sID;
                             module[j] = module[j + 1];
                             module[j + 1].mark = temp.mark;
                             module[j + 1].sID = temp.sID;
                   pass++;
              outputSID = String.valueOf(module[module.length].sID);
              outputMark = String.valueOf(module[module.length].mark);
              return (outputSID + " " + outputMark);
         public static String findLowest(StudentRecord module[], int numOfStudents)
              String outputMark;
              String outputSID;
              int j;
              StudentRecord temp = new StudentRecord();
              boolean intChange = true;
              int pass = 1;
              while((pass <= numOfStudents - 1) && (intChange))
                   intChange = false;
                   for (j = 1; j <= numOfStudents - pass; j++)
                        module[j] = new StudentRecord();
                        if(module[j].mark > module[j + 1].mark)
                             intChange = true;
                             temp.mark = module[j].mark;
                             temp.sID = module[j].sID;
                             module[j] = module[j + 1];
                             module[j + 1].mark = temp.mark;
                             module[j + 1].sID = temp.sID;
                   pass++;
              outputSID = String.valueOf(module[1].sID);
              outputMark = String.valueOf(module[1].mark);
              return (outputSID + " " + outputMark);
         public static String findGrade(StudentRecord module[], int numOfStudents, long studentID)
              String foundGrade = "";
              int i;
              String outputSID;
              String outputMark;
              for (i = 1; i <= module.length; i++)
                   module[ i] = new StudentRecord();
                   if (studentID == module[ i].sID)
                        outputSID = String.valueOf(module[ i].sID);
                        outputMark = String.valueOf(module[ i].mark);
                        foundGrade = (outputSID + " " + outputMark);
              if (foundGrade == "")
                   JOptionPane.showMessageDialog(null,
                        "No grade found for Student: " + studentID);
              return foundGrade;
         public static void studentIDSort(StudentRecord module[], int numOfStudents)
              int i;
              int j;
              StudentRecord temp = new StudentRecord();
              for (i = (module.length - 1); i >= 0; i--)
                   for (j = 1; j <= i; j++)
                        module[j] = new StudentRecord();
                        if (module[j - 1].sID > module[j].sID)
                             temp = module[j - 1];
                             module[j - 1] = module[j];
                             module[j] = temp;
         public static void markSort(StudentRecord module[], int numOfStudents)
              int i;
              int j;
              StudentRecord temp = new StudentRecord();
              for (i = (module.length - 1); i >= 0; i--)
                   for (j = 1; j <= i; j++)
                        module[j] = new StudentRecord();
                        if (module[j - 1].mark > module[j].mark)
                             temp = module[j - 1];
                             module[j - 1] = module[j];
                             module[j] = temp;
         public static void displayData(StudentRecord module[], int numOfStudents)
              String outputMessage = "";
              int i;
              for (i = 1; i <= module.length; i++)
                   module[ i] = new StudentRecord();
                   outputMessage += (module[ i].sID + " " + module[ i].mark + "\n");
              JOptionPane.showMessageDialog(null,
                   "Data Display\n" +
                   "**** *******\n\n" +
                   outputMessage,
                   "Data Display", JOptionPane.INFORMATION_MESSAGE);
    }

    Try this piece of code...... I adapted it to your program, so it starts from 1. You should pass numOfStudents - 1 as numOfStudents to don't get the notorious error =D
    if (menuChoice.equals("1"))
    findHighest(module, numOfStudents - 1);
    I added the println statement because in your prog isn't present an output routine (well, at last I didn't see it..... maybe because I'm sleepy =) )
    public static void findHighest(StudentRecord module[], int numOfStudents)
    String outputMark;
    String outputSID;
    StudentRecord retValue = new StudentRecord();
    retValue.sID = module[1].sID;
    retValue.mark = module[1].mark;
    for (int i = 2; i <= numOfStudents; i++) {
         if (module.mark > retValue.mark) {
         retValue.sID = module[i].sID;
         retValue.mark = module[i].mark;
    outputSID = String.valueOf(retValue.sID);
    outputMark = String.valueOf(retValue.mark);
    System.out.println(outputSID + " " + outputMark);
    Hope it can help you

  • Problem in F data type

    Hi experts...
    I am using F data type and it gets value 5.50000000000E+10.
    but I want value like 5.500.
    I don't want to use P data type.
    Please Help me.
    thanks in advance.

    Ankita,
    Try declaring it as type quann and check.
    Some additional info:-
    Type F values range from /- 2.2250738585072014E-308 to 1.7976931348623157E308, as well as the number 0, with an accuracy of at least 15 decimal places.
    You cannot enter floating point numbers directly in your programs. Instead, you must use text literals that can be interpreted as floating point numbers. You may use the following formats:
    Decimal numbers with or without sign, with or without decimal point. The form <mantissa> E<exponent>, where the mantissa is a decimal. The exponent may be specified either with or without sign. You may also use spaces before or after the number. Examples of text literals with "floating point numbers":
    '1', '-12.34567', '-765E-04', '1234E5', '12E34', '+12.3E-4', '1E160'.
    Use floating point arithmetic if you need a very large value range or you are making decimal calculations, but be aware of the following features of floating point arithmetic.
    Internally, the exponent and the mantissa of floating point numbers are stored separately, each in two parts. This can lead to unexpected results, despite the high degree of intrinsic accuracy. These occur mainly when performing conversions from and to type F.
    For example, the number 1.5 can be represented exactly in this notation, since 1.5 = 120 + 12**(-1), but the number 0.15 can only be represented approximately by the number 0,14999999999999999. If you round 0.15 up to 1 valid digit, the result is 0.1 rather than 0.2 as you would expect. On the other hand, the number 1.5E-12 is represented by the number 1.5000000000000001E-12, which would be rounded to 2E-12.
    Another example which actually occurred is the calculation of 7.27% of 73050 to an accuracy of 2 decimal places. The intermediate result 5.3107349999999997E+03, since the correct result, 5310.735, cannot be represented exactly in two parts with 53 bits. (If the hardware cannot represent a real number exactly, it uses the next representable floating point number. After rounding, you therefore get 5310.73 rather than 5310.74 as you would expect.
    The ABAP runtime system calculates commercially and not "numerically" like the underlying machine arithmetic. According to the rounding algorithm of the latter, the end digit 5 must always be rounded to the nearest even number (not the next largest number), i.e. from 2.5 to 2, 3.5 to 4.
    You should also note that multiplication using powers of 10 (positive or negative), is not an exact operation. For example, although 100.5 can be represented exactly in two parts, after the operation
    F = F / 100 * 100
    F has the value 100.49999999999999.
    As well as rounding errors, the restricted number of decimal places for the mantissa can lead to the loss of trailing digits. For example, 1 - 1.0000000000000001 results in zero.
    This means that you cannot rely on the last digits in floating point arithmetic. In particular, you should not usually test two floating point numbers for equality; instead, you should check whether the relative difference abs((a - b)/a) is less than a predefined limit, e.g. 10**(-7).
    K.Kiran.

  • Error While Creating Date type condition query

    Hi All,
    I am getting following error while creating a multiple condition query.
    ERROR:java.lang.IllegalArgumentException: Unexpected field type for D: java.lang.String
    I am pasting the scrap of the code for review below.
    pls note after removing the condition cond6; it works fine, and cond6 is for date type field.
    for(int j=1;j<7;j++){                          
    fd[j] =trd.getFieldDescriptor(arrayHeaderFieldNames[j]);
    BasisFieldType bft1 =  fd[j].getFieldType();
    if (bft1 == BasisFieldType.C) {
      filterOperator[j] = RelationalOperatorType.CONTAINS;       }
    else{
      filterOperator[j] = RelationalOperatorType.EQUALS;
    order[j] =queryFactory.createSortOrder(fd[j],true);
    cond1 =queryFactory.createCondition(fd[1], filterOperator[1], values[0]);
    cond2 =queryFactory.createCondition(fd[2], filterOperator[2], values[1]);
    cond3 =queryFactory.createCondition(fd[3], filterOperator[3], values[2]);
    cond4 =queryFactory.createCondition(fd[4], filterOperator[4], values[3]);
    cond5 =queryFactory.createCondition(fd[5], filterOperator[5], values[4]);
    cond6 =queryFactory.createCondition(fd[6], filterOperator[6], values[5]);
    Condition cond = queryFactory.createCondition(new Condition[]{cond1,cond2,cond3,cond4,cond5,cond6},LogicalOperatorType.AND);
    Please Help!
    Thanks n regards,
    Kapoorchand.

    Hi,
    well that problem is a long time back -. I only have in mind that the date I had to transfer to the quesry was in a "strange" format. Have a lock into the documentation for the date field - your date field is not recognised as a date field from the quesry engine and so this fails - but unfortunately I have no idea at the moment how I fixed it last time - how I converted my date field......
    Sorry, thast I can not give you the real point - but I will have a lock into the old code - hopefully I find it soon.
    Regards,
    Oliver

  • Runtime conversion of a string value to a primitive data type in java

    can anyone of you give me an idea to convert a string value to a primitive data type during run time...i have the value and the type to which it has to be converted as String values...do you have any idea ,...pls share

    String recvalvalue = inputval;
                    String recvartype = inputtype;
                   if (recvartype.equals("int")){
                   value0 = Integer.parseInt(recvalvalue);
             else
             if (recvartype.equals("double")){
                    value1  = Double.parseDouble(recvalvalue);
             else
             if(recvartype.equals("float")){
              value2 = Float.parseFloat(recvalvalue);
             else
             if(recvartype.equals("Boolean")){
              value3 = Boolean.parseBoolean(recvalvalue);
             else
             if(recvartype.equals("char")){
               value4 = (char)recvalvalue.charAt(0);
            else
            if(recvartype.equals("String")){
              value5 = recvalvalue;
             else
             if(recvartype.equals("byte")){
               value6 = Byte.parseByte(recvalvalue);
                  //listA.add(6, value6);
                  //     listA.g = value6;
             else
              if(recvartype.equals("long")){
               value7 = Long.parseLong(recvalvalue);
             else
              if(recvartype.equals("short")){
              value8 = Short.parseShort(recvalvalue);
             } yes i can do this but the resultant value has to be assigned to a variable of a specific type which is here recvartype .....it has to be done dynamically automatically..if we know what type of data is that we can convert and assign to the type but we donot know when we run the program as the program will be supllied by someone and has to be executed

  • Issue with Oracle LONG RAW data type

    Hi All,
    I am facing some issues with Oracle LONG RAW DATA Type.
    We are using Oracle 9IR2 Database.
    I got a table having LONG RAW column and I need to transfer the same into another table having LONG RAW column.
    When I tried using INSERT INTO SELECT * command (or) CREATE TABLE as select * , it is throwing ORA-00997: illegal use of LONG datatype.
    I have gone through some docs and found we should not use LONG RAW using these operations.
    So I did some basic PLSQL block given below and I was able to insert most of the records. But records where the LONG RAW file is like 7O kb, the inserting is faliling.
    I tried to convert LONG RAW to BLOB and again for the record where the LONG RAW is big in size I am getting (ORA-06502: PL/SQL: numeric or value error) error.
    Appreciate if anyone can help me out here.
    DECLARE
    Y LONG RAW;
    BEGIN
    FOR REC IN (SELECT * FROM TRU_INT.TERRITORY WHERE TERRITORYSEQ=488480 ORDER BY TERRITORYSEQ ) LOOP
    INSERT INTO TRU_CMP.TERRITORY
    BUSINESSUNITSEQ, COMPELEMENTLIFETIMEID, COMPONENTIMAGE, DESCRIPTION, ENDPERIOD, GENERATION, NAME, STARTPERIOD, TERRITORYSEQ
    VALUES
    REC.BUSINESSUNITSEQ, REC.COMPELEMENTLIFETIMEID, REC.COMPONENTIMAGE, REC.DESCRIPTION, REC.ENDPERIOD, REC.GENERATION, REC.NAME,
    REC.STARTPERIOD, REC.TERRITORYSEQ
    END LOOP;
    END;
    /

    Maddy wrote:
    Hi All,
    I am facing some issues with Oracle LONG RAW DATA Type.
    We are using Oracle 9IR2 Database.
    I got a table having LONG RAW column and I need to transfer the same into another table having LONG RAW column.
    When I tried using INSERT INTO SELECT * command (or) CREATE TABLE as select * , it is throwing ORA-00997: illegal use of LONG datatype.
    I have gone through some docs and found we should not use LONG RAW using these operations.
    So I did some basic PLSQL block given below and I was able to insert most of the records. But records where the LONG RAW file is like 7O kb, the inserting is faliling.
    I tried to convert LONG RAW to BLOB and again for the record where the LONG RAW is big in size I am getting (ORA-06502: PL/SQL: numeric or value error) error.
    Appreciate if anyone can help me out here.
    DECLARE
    Y LONG RAW;
    BEGIN
    FOR REC IN (SELECT * FROM TRU_INT.TERRITORY WHERE TERRITORYSEQ=488480 ORDER BY TERRITORYSEQ ) LOOP
    INSERT INTO TRU_CMP.TERRITORY
    BUSINESSUNITSEQ, COMPELEMENTLIFETIMEID, COMPONENTIMAGE, DESCRIPTION, ENDPERIOD, GENERATION, NAME, STARTPERIOD, TERRITORYSEQ
    VALUES
    REC.BUSINESSUNITSEQ, REC.COMPELEMENTLIFETIMEID, REC.COMPONENTIMAGE, REC.DESCRIPTION, REC.ENDPERIOD, REC.GENERATION, REC.NAME,
    REC.STARTPERIOD, REC.TERRITORYSEQ
    END LOOP;
    END;
    /below might work
    12:06:23 SQL> help copy
    COPY
    Copies data from a query to a table in the same or another
    database. COPY supports CHAR, DATE, LONG, NUMBER and VARCHAR2.
    COPY {FROM database | TO database | FROM database TO database}
                {APPEND|CREATE|INSERT|REPLACE} destination_table
                [(column, column, column, ...)] USING query
    where database has the following syntax:
         username[/password]@connect_identifier

  • Help needed in data type casting

    I have a java program which will receive data and its type in the String format. During program execution, the data in the String data has to be converted into the respective data type and assigned to a variable of that data type so that it could be used in the program. Programmer may not know the type of data that the value has to be converted into.
    I really got struck up with this. This is a RMI application and one process node is sending the data to another node in the String format and the type of data it should get converted into so that it can be converted into the respective type and used for computation.
    Can you understand what I am asking for ....if you can pls help and it is highly appreciated

    I dont know whether i ahve expressed it correctly
    look at this code
    dataPacket sendtoNode = send.senDatatoNode(inputReq);
    String recnodnum = sendtoNode.nodeNum;
    String recvarnum = sendtoNode.varNum;
    String recvartype = sendtoNode.dataType;
    String recvalvalue     = sendtoNode.dataVal;
    int num;     int type;
    double result;
    // here in this case the result variable type is double
    if (recvartype.equals("int")){
              type = 1;
         result = Integer.parseInt(recvalvalue); will pose problem
         else
         if (recvartype.equals("double")){
              type = 2;
              result = Double.parseDouble(recvalvalue);
         else
         if(recvartype.equals("float")){
              type =3;
              result = Float.parseFloat(recvalvalue); will pose problem
         else
         if(recvartype.equals("Boolean")){
              if ((recvalvalue.equals("true")) || (recvalvalue.equals("TRUE")))
              type = 4;
              result = Boolean.parseBoolean(recvalvalue); will pose problem
         else
         if(recvartype.equals("char")){
              type = 5;
              result = (char)recvalvalue; will pose problem
    else
    if(recvartype.equals("String")){
         type = 6;
              result = recvalvalue; will pose problem
         else
         if(recvartype.equals("byte")){
              type = 7;
              result = Byte.parseByte(recvalvalue); will pose problem
         else
         if(recvartype.equals("long")){
              type = 8;
              result = Long.parseLong(recvalvalue); will pose problem
         else
         if(recvartype.equals("short")){
              type = 9;
              result = Short.parseShort(recvalvalue); will pose problem
         //forvarval varvalue = new forvarval();
         //varvalue.forvarval(recvartype, recvalvalue);
    // this has to be done after sorting the problem of type casting string result = recvalvalue;
    //result = value; //<this will surely give me a problem as i m assigning string to double>??
    send.host(result);
    System.out.println("result received and the result is " +recvalvalue );
    now i need to assign the converted string in to a variable and use in the compuation ..thts where the challenge n not in teh conversion process...

  • Rowid data type

    Hi All,
    I pass rowid from select stmt to update stmt in plsql, so update is quicker. There is bunch of if else statements before update is issued.
    Question is I declared v_rowid to be varchar2 and it gives me numeric error. Should I declare it as rowid data type ? Do I have to worry about the size ?
    Thanks for any help
    Vissu

    I am not sure For me it is working
    Connected to:
    Oracle Database 10g Enterprise Edition Release 10.2.0.2.0 - 64bit Production
    With the Partitioning, OLAP and Data Mining options
    SQL>  declare
      2   r rowid;
      3   begin
      4   select rowid into r from t where rownum<2;
      5   end;
      6  /
    PL/SQL procedure successfully completed.
    SQL>
    Connected to:
    Oracle9i Enterprise Edition Release 9.2.0.4.0 - 64bit Production
    With the Partitioning option
    JServer Release 9.2.0.4.0 - Production
    SQL> ed
    Wrote file afiedt.buf
      1   declare
      2   r rowid;
      3   begin
      4   select rowid into r from t1 where rownum<2;
      5*  end;
    SQL> /
    PL/SQL procedure successfully completed.
    SQL> r
      1   declare
      2   r rowid;
      3   begin
      4   select rowid into r from t1 where rownum<2;
      5*  end;
    PL/SQL procedure successfully completed.
    SQL> Message was edited by:
    devmiral

  • How to set default value to date type attribute.

    Hi,
    How to set default value to date type attribute.
    E.g I want to set u201C01/01/1999u201D to date attributes.
    First i want to set value and then i want to fetch the same & want to check equals.
    please suggest solution.
    Regards,
    Smita

    Hi,
    In wdinit() method u can set the date
    DateFormat df = new SimpleDateFormat("MM/dd/yyyy");
    Date today = Calendar.getInstance().getTime();
    String reportDate = df.format(today);
    wdContext.currentContextElement().setFromDate(reportDate);
    Another way you have set the this formate like that
    1. Create a Simple type under "Dictionaries->SimpleType" called DateFormat
    2. Select the type as "date"
    3. Go to the "Representation" tab and set the format as "dd/MM/yyyy" (or whatever u want, but month should be MM)
    4.Bind the context attribute to the type created now.
    Hope this helps u.
    Best Regards
    Vijay K

Maybe you are looking for

  • Audio hum in recording on my Mini?

    I just recently got the $799 Mac Mini version and when I record audio in Garage Band 3 or other audio apps I get a steady hum on the recording. I am using a powered MXL 990 mic through a mixer and then into the audio in on the Mini. The vocal recordi

  • A trigger blocking function  for control cycle in Kanban

    Hi, I wantet to change the status in Kanban. I get this error u201CA trigger blocking function was defined for the control cycle in the replenishment strategyu201D. I don't want to set a period of blocking function. how can I deactivate it. Thanks

  • Table per locale - i18n application development approach

    I learn that I shall use table per locale approach for a multi-language application development. And I am in a situation that no all entries will have multi-language versions. I can image some possible issues on data retrieval and update. Can anyone

  • Anyone knows about using java to get data from MS Access database.

    hi there anyone knows about using java to get data from MS Access database? thank you

  • How do I configure ApplicationManager poll frequency

    Profiling the server on what should be a CPU intensive job I find that 20% of the elapsed time and the majority of the CPU time is spent inside the 'mbeans'. This looks to be associated with the ApplicationManager's poll period which I would like to