Using a variable to select array value

Hey,
Im fairly new to Java, and im doing a course in it at the moment. I have been set some homework to do, but ive got a little stuck ...what i have to do is create a program that randomly generates numbers between 1 and 10, and then i have made an array which has 10 values, and say number 1 comes up in the random number generation, i want array [1] to have the number of times 1 appears in it. Ive came up with the following, but i keep getting errors ...i think there is a problem with defineing the variable i as a long, then the array as an integer...
int[] ar = {0,0,0,0,0,0,0,0,0,0};
int a = 0;
while (a<10)
a++;
long i = Math.round(Math.random()*10);
ar[i] = i;
     System.out.println(ar);
with that code i get these errors:
found : long
required: int
ar[i] = i;
^
C:\Website Projects\Java Work\test 1\Document.java:14: possible loss of precision
found : long
required: int
ar[i] = i;
if anyone could help me get this working i would be most greatful
Thanks for your time,
-Ross

ah k thanks for the response :) ...ive managed to narrow it down to one error:
public class random {
public static void main(String[] args){
int[] ar = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
int i = 0;
while (i < 10){
int t = Math.round(Math.random()*10);
     int ar[t]++;}
     i++;
System.out.println(ar);
gives the error:
C:\Website Projects\Java Work\test 1\random.java:8: ']' expected
     int ar[t]++;}
^
1 error
Tool completed with exit code 1
Im pretty sure it just doesnt like the value of the Math.xxxx being int, i was told it requires long/double...i need to convert it somehow after its done the calculation, i think :-S
Thanks,
Ross

Similar Messages

  • How to use one variable as a default value for another variable?

    Hi Experts,
    Is it possible to use one variable as a default value for another variable?
    For example:
    Variable 1 = current calendar year month
    Variable 2 = mandatory input ready variable for calendar year month
    I want to use variable 1 as default value for variable 2, but also have the ability to change the month if required.
    Thanks!
    Kathryn

    u can use replacement path variable
    in that case u can replace the values of 1 variable with the another variable...
    but  u cannot do this setting
    u cannot make variable 2 as mandatory
    u cannot enter value for variable 2
    because by default it will take the value of variable 1
    u have to make follow settings
    variable 2
    name , technical name
    processing by = replacement path
    infoobject = ocalmonth
    next tab
    replaced by another variable
    variable name
    offset start , offset lenght
    save and hit okey

  • Using a Variable to select a function

    Hi there.
    I am looking to use a variable that is set when a user clicks
    a button to then use as the variable name to call a function. The
    actual functions work, but when using a variable as the function
    name it doesn't call the function. Here's my code so far, could
    anyone help with what I may be doing wrong (please see code snippet
    attached).
    Thanks a lot
    Tony Mead

    Thanks for the reply Dave. I wanted to use a variable because
    when any of the 4 buttons are clicked they have to
    1. Run the function determined by the closeActive variable
    (closing the open panel - could be 1 of 4)
    2. open and run a particular panel
    Probably best explaind by looking at what I have done so far
    (home & about us only at the moment):
    http://www.soapbox-creative.com/development/08/index.html
    Basically I needed the flash movie to 'know' what panel is
    currently opn and when another button is clicked it can just run
    the close function and close the panel that is open.
    Thanks again
    Tony

  • Odd Behaviour using User Variables to select members in Planning form

    I have a form to enter budget adjustments and another form to review the effects of those adjustments at a parent Entity level.
    For each area of the business there are obviously different adjustment and parent levels required in the form.
    In summary I can drive a form from a User Variable using the functions (Children, IChildren, ILvl0Descendants, Descendants and IDescendants) but trying to use other options results in unexpected behaviour.
    For example with the following structure:
    Entity
    -Total Cost Centre
    --Group A
    ---SubGroupA1
    ---SubGroupA2
    ---SubGroupA3
    ---GroupA-Adj
    ----GroupA-AdjX
    -----AdjEntityA1
    -----AdjEntityA2
    --Group B
    ---SubGroupB1
    ---SubGroupB2
    ---SubGroupB3
    ---GroupB-Adj
    ----GroupB-AdjX
    -----AdjEntityB1
    -----AdjEntityB2
    For the adjustment entry form the users would want to see AdjEntityA1 and AdjEntityA2 if they are in business group A.
    For the review form they would like to see Group A and its children.
    I am trying to avoid writing multiple forms for each business user (largely because the number of groups can vary dramatically). I can't really use generations to drive the selections as whilst the business has effectively levelled the hierarchy business units can be working at different levels of this hierarchy.
    I want to offer a couple of options to the business. One will be to define a form that pulls all of the relevant entities into the form and relies on security to restrict the values displayed to the user. The second option would be to utilise User Variables to drive selections. It is the second option I am struggling with.
    If we consider a user working in Group A, I think I can see a formulaic way to select the various combinations of Entities if I set the user variable to be GroupA-Adj.
    I can define a data form that sets Entity to the L0Descendants of say GroupA-Adj and this is fine.
    When I try to define a review form that selects the Isiblings and Parent of GroupA-Adj I hit a problem.
    It seems that Children, IChildren, ILvl0Descendants, Descendants and IDescendants works as I would expect.
    Using IAncestors and IParents return just the User Variable setting (i.e. just the 'I' part, not the parents or Ancestors).
    Siblings, Isiblings, Parents, Ancestors all result in an error message because not all dimensions are represented in the form.
    This prevents me using a User Variable to build the review form in which I would like to display the siblings and parent of the entity GroupA-Adj.
    Anyone got any ideas?

    I would love to see the ability to select EDA's from Planning Forms, it would definately make life a little easier.
    As CL says, attributes are great at filtering forms and BR's, their only drawback is that you can only use them on sparse dimensional members.
    To get round this problem i've relied on security to filter out the accounts i do not need to see in the forms for the specific users, and kept the form selection on @IDESCENDANTS(Account_Parent).
    If you wish to filter on the Period dimension and this is a dense dimension, can you not get round the problem with rollups and, for example, @DESCENDANTS(Q1) to only return 3 months in the form, it really depends on your outline structure.

  • How can I use a variable as an array's name?

    Ok I have several arrays in my code (lets call them "array1", "array2" etc) and I want to load them based on the users input. So if the user enters array1, I want the first array to be loaded, and the same with the other arrays.
    I tried saving the user's input on a string variable called ARRAY_NAME, so that each time the user enters a different array name, the corresponding array is loaded. Something like this:
      ARRAY_NAME[c1][c2]; but I get this error:
    array required, but java.lang.String found
              ARRAY_NAME[c1][c2];
    ___________^
    Can you please tell me what is the correct way of doing it?
    Thanx!

    The short answer is you can't. An object name can't be
    variable and must be known at compile time. But you
    could associate the user input name with a particular
    array, for example, using a HashMap with the user name
    as the key to an array. However, you'd need to use a
    container class (Vector, ArrayList, etc.) rather than
    a raw array, because containers only take class
    instances as elements.Maps can't deal with primitives, that is true. However, arrays are full scale objects, so they can be put into maps.
    Also, my code had a bug in it. Try this:
    int userIndex = getUserIndex();
    String userInput = getUserInput();
    Field array = getClass().getDeclaredField(userInput);
    Object item = Array.get(array.get(this), userIndex);

  • Using Bind Variable in Select List

    Hi
    I am using Jdev 11.1.1.5 . I am trying to create a view object with select column being populated using the bind parameter.
    Below is the code that i am using for creating View-Object as i want the parameter that user is passing while executing the view object should be displayed to user as a column
    SELECT TestPEO.<Column Name>,
           TestPEO.<Column Name>,
           :pStartDate PARAM_START_DATE,
           :pEndDate PARAM_END_DATE
    FROM <Table Name> TestPEOFor setting the above bind parameter i tried over-riding prepareRowSetForQuery method with default values being passed but it didnt helped out....Getting error " java.sql.SQLException: Missing IN or OUT parameter at index:: 1"
        public void prepareRowSetForQuery(ViewRowSetImpl vrs) {
        vrs.ensureVariableManager().setVariableValue("pStartDate",  new Date((new java.util.Date()).getTime()));
        vrs.ensureVariableManager().setVariableValue("pEndDate",  new Date((new java.util.Date()).getTime()));
        super.prepareRowSetForQuery(vrs);
        System.out.println("query "+getQuery());
        }Any idea regarding it will be helpful.. Please share your views in case there is any other approach to it.
    Thanks
    AJ

    Got it working.... :)
    Thanks

  • Problem in using the install()'s byte array values?

    I tried to pass the values to the OwnerPIN object at the time of initialization. But when I try to install the applet I will get 6A80 error code . Can anybody tell me why I am getting this message. And if i use some different data values for pin.update() then I wont come across those error codes
    public static void install(byte[] bArray, short bOffset, byte bLength)     {          
              // GP-compliant JavaCard applet registration
              new SampleApp(bArray, (short) (bOffset), bLength);                    
         private SampleApp(byte[] bArray, short bOffset, byte bLength){
              pin = new OwnerPIN(PIN_TRY_LIMIT, MAX_PIN_SIZE);
              pin.update(bArray,bOffset, bLength);          
                    register();
    cm>  install -i a00000006203010c0601 -l -q C9#(1122331122331122) a00000006203010c06 a00000006203010c0601
    => 80 E6 0C 00 2E 09 A0 00 00 00 62 03 01 0C 06 0A    ..........b.....
        A0 00 00 00 62 03 01 0C 06 01 0A A0 00 00 00 62    ....b..........b
        03 01 0C 06 01 01 10 0A C9 08 11 22 33 11 22 33    ..........."3."3
        11 22 00 00
    ( 5411 usec)
    <= 6A 80

    GP 2.1.1, A.2 GlobalPlatform on a Java Card, Installation:
    Installation
    In Section 3.1 - The Method install of the Java Card� 2.1.1 Runtime Environment (JCRE) Specifications,
    the parameters passed to the method are defined to be initialization parameters from the contents of the incoming
    byte array parameter.
    In the definition of the install method of the Class Applet of the Java Card� 2.1.1 Application Programming
    Interface, the install parameters to be supplied must be in the format defined by the applet.
    This specification expands on this requirement and further defines the content of the install parameters. This
    expansion affects both the implementation of an OPEN and the behavior of a Java Card applet developed for a
    GlobalPlatform card. It does not affect the definition of the install method of the Class Applet of the Java
    Card� 2.1.1 Application Programming Interface specification.
    The install parameters shall identify the following data, present in the INSTALL [for install] command (see
    Section 9.5.2.3.2 - Data Field for INSTALL [for install]):
    � The instance AID,
    � The Application Privileges and,
    � The Application Specific Parameters.
    [While the APDU command contains install parameters representing TLV coded system and application specific parameters, the
    application only requires knowledge of the Application Specific Parameters i.e. only LV of the TLV coded structure �C9� are
    present as parameters.]
    The OPEN is responsible for ensuring that the parameters (bArray, bOffset and bLength) contain the
    following information:
    The array, bArray, shall contain the following consecutive LV coded data:
    _� Length of the instance AID,_
    _� The instance AID,_
    _� Length of the Application Privileges,_
    _� The Application Privileges,_
    _� Length of the Application Specific Parameters and,_
    _� The Application Specific Parameters._
    The byte, bOffset, shall contain an offset within the array pointing to the length of the instance AID.
    The byte, bLength, shall contain a length indicating the total length of the above-defined data in the array.
    The applet is required to utilize the instance AID as a parameter when invoking the register (byte []
    bArray, short bOffset, byte bLength) method of the Class Applet of the Java Card� 2.1.1
    Application Programming Interface specification.

  • Using Bind Variable in a SELECT

    Hi,
    I'm trying to build up my SQL query at run-time using bind variables and in the Oracle® Fusion Middleware Fusion Developer's Guide for Oracle Application Development Framework 11g Release 1 (11.1.1) it says that 'After defining the bind variables, the next step is to reference them in the SQL statement. While SQL syntax allows bind variables to appear both in the SELECT list and in the WHERE clause, you'll typically use them in the latter context, as part of your WHERE clause.'.
    However, when I try to use the bind variables in my SELECT list because I've had to set a type for the variable to String the variable gets inserted with inverted commas either side e.g. SELECT 'Service' FROM TestTable. Is it possible to use bind variables to insert a value into my select list without these inverted commas around it?
    Thanks in advance,
    Tom

    OK, thanks for your response. Do you know of a way then where I can control my SELECT parameters programmatically? I'm currently trying to do it using the information in the chapter '35.9 Using Programmatic View Objects for Alternative Data Sources' from the Oracle® Fusion Middleware Fusion Developer's Guide for Oracle Application Development Framework 11g Release 1 (11.1.1). I think I'm part way there, would this be the correct way of acheiving what I want?
    Cheers, Tom

  • Simple use of variables in query

    Hi,
    i've just started using PL/SQL and as a long time user of TSQL the syntax is a bit confusing for me. I'm trying to test a simple query - using a variable to select some rows from a table. Lest assume that we have a table with data from different days and we want to view data from specific day.
    I could use:
    SELECT * FROM TABLE
    where TRADE_DATE = '2010-10-23'
    but what i would like to do is to pass the date value as a variable, in TSQL i'd just write:
    declare @trade_date datetime
    set @trade_date = '2010-10-23'
    SELECT * FROM TABLE
    where TRADE_DATE = @trade_date
    Could someone help me and write the last query using PL/SQL syntax?
    Also - it there some kind of a tutorial for people like me? comparison of simple queries written in both languages? tried to google it but didn't have luck.

    There are a couple of differences besides variable syntax. The variable would look like this in PL/SQL:
    declare
        v_trade_date date := DATE '2010-10-23';
    begin
        select * into ?????  -- see below
        from   table
        where  trade_date = v_trade_date;
    end;However the next difference is that PL/SQL does not implicitly return result sets to the client application, so you either have to select <b>into</b> a PL/SQL variable, or process the values in a loop, or explicitly return a ref cursor (or just do the processing in SQL statements within the procedure, without returning anything). I don't know much about T-SQL but I have the impression that in Oracle there is a stronger distinction between SQL (the interpreted query language) and PL/SQL (the compiled programming language) than the equivalents in SQL Server. Saubhik's example above is not PL/SQL (which you asked about) but plain SQL.
    Using the example of SQL*Plus, you might use a ref cursor like this:
    var r refcursor;
    declare
        v_trade_date date := DATE '2010-10-23';
    begin
        open :r for
        select *
        from   test_table
        where  trade_date = v_trade_date;
    end;
    print :ror
    var r refcursor;
    create or replace procedure p (p_out_results out sys_refcursor)
    as
        v_trade_date date := DATE '2010-10-23';
    begin
        open p_out_results for
        select *
        from   test_table
        where  trade_date = v_trade_date;
    end p;
    set autoprint on
    exec p(:r)Edited by: William Robertson on Oct 24, 2010 5:31 PM

  • Using Static Variable against Context Attribute for Holding IWDView

    Dear Friends,
    I have a method which is in another DC which has a parameter of the type IWDView. In my view, I will have an action which will call the method in another component by passing the value for the view parameter. Here, I can achieve this in 2 types. One is - I declare a static variable and assign the wdDoModifyView's view as parameter value and I can pass this variable as parameter whenever calling that method or the second way - create an attribute and assign the same wdDoModifyView's view parameter as its value. Whenever I call this method, I can pass this attribute as parameter. What is the difference between these two types of holding the value since I am storing the same value i.e., wdDoModifyView's view parameter. But when I trigger the action from different user sessions, the first type of code (using static variable) prints the same value in both the sessions for view.hashCode() and View.toString(), but the same is printing the different values when I pass the attribute which holds the view parameter.
    Clarification on this is highly appreciated
    The problem I face is when I use static variable to get the view instance and export the data using the UI element's id, the data belonging to different user sessions is mixed up where as when I use Context Attribute, the same problem doesn't arise. I want to know the reason why it is so. Is there any other place or way where I can get the current view instance of each session instead of wdDoModifyView?

    Hi Sujai ,
    As you have specified the problem that we face when we use  static attributes, when end users are using the application .
    Static means i  have n number of objects but the static variable value will remain same every where.
    when it is context attribute for every object i.e nth object you have a nth context attribute i mean nth copy of the context attribute.
    so every user has a unique Iview parameter , when context is used and
    when static is used  , assume you have userA , his iview is set this intially  and u have another user B , when he is using  , since the variable is static and when you access this variable you will get the value of userA.
    Regards
    Govardan Raj

  • Trying to pass array to stored procedure in a loop using bind variable

    All,
    I'm having trouble figuring out if I can do the following:
    I have a stored procedure as follows:
    create procedure enque_f826_utility_q (inpayload IN f826_utility_payload, msgid out RAW) is
    enqopt dbms_aq.enqueue_options_t;
    mprop dbms_aq.message_properties_t;
    begin
    dbms_aq.enqueue(queue_name=>'f826_utility_queue',
    enqueue_options=>enqopt,
    message_properties=>mprop,
    payload=>inpayload,
    msgid=>msgid);
    end;
    The above compiles cleanly.
    The first parameter "inpayload" a database type something like the following:
    create or replace type f826_utility_payload as object
    2 (
    3 YEAR NUMBER(4,0),
    4 MONTH NUMBER(2,0),
    83 MUSTHAVE CHAR(1)
    84 );
    I'd like to call the stored procedure enque_f826_utility_q in a loop passing to it
    each time, new values in the inpayload parameter.
    My questions are:
    First, I'm not sure in php, how to construct the first parameter which is a database type.
    Can I just make an associative array variable with the keys of the array the same as the columns of the database type shown above and then pass that array to the stored procedure?
    Second, is it possible to parse a statement that calls the enque_f826_utility_q procedure using bind variables and then execute the call to the stored procedure in a loop passing new bind variables each time?
    I've tried something like the following but it's not working:
    $conn = oci_pconnect (....);
    $stmt = "select * from f826_utility";
    $stid = oci_parse($conn, $sqlstmt);
    $r = oci_execute($stid, OCI_DEFAULT);
    $row = array();
    $msgid = "";
    $enqstmt = "call enque_f826_utility_q(:RID,:MID)";
    $enqstid = oci_parse($conn, $sqlstmt);
    oci_bind_by_name($enqstid, ":RID", $row); /* line 57 */
    oci_bind_by_name($enqstid, ":MID", $msgid);
    while ($row = oci_fetch_array($stid, OCI_RETURN_NULLS+OCI_ASSOC))
    ++$rowcnt;
    if (! oci_execute($enqstid)) /* line 65 */
    echo "Error";
    exit;
    When I run this, I get the following:
    PHP Notice: Array to string conversion in C:\Temp\enqueue_f826_utility.php on l
    ine 57
    Entering loop to process records from F826_UTIITY table
    PHP Notice: Array to string conversion in C:\Temp\enqueue_f826_utility.php on l
    ine 65
    PHP Warning: oci_execute(): ORA-06553: PLS-306: wrong number or types of argume
    nts in call to 'ENQUE_F826_UTILITY_Q' in C:\Temp\enqueue_f826_utility.php on lin
    e 65
    PHP Notice: Undefined variable: msgnum in C:\Temp\enqueue_f826_utility.php on l
    ine 68
    Error during oci_execute of statement select * from F826_UTILITY
    Exiting!

    Thanks for the reply.
    I took a look at this article. What it appears to describe is
    a calling a stored procedure that takes a collection type which is an array.
    Does anyone from Oracle know if I can pass other database type definitions to a stored procedure from PHP?
    I have a type defined in my database similar to the following which is not
    an array but a record of various fields. This type corresponds to a payload
    of an advanced queue payload type. I have a stored procedure which will take as it's input, a payload type of this structure and then enqueue it to a queue.
    So I want to be able to pass a database type similar to the following type definition from within PHP. Can anyone from Oracle verify whether or not this is possible?
    create or replace type f826_utility_payload as object
    YEAR NUMBER(4,0),
    MONTH NUMBER(2,0),
    UTILITY_ID NUMBER(10,0),
    SUBMIT_FAIL_BY VARCHAR2(30),
    MUSTHAVE CHAR(1)
    );

  • How to use a variable value set from custom dll in dataset

    Hi,
    I've inherited a SSRS report that I need to add some functionality to.  I'm setting a variable, ADAuthorizations, from a custom dll 
    ADAuthorizations is a string of all AD groups a user is a member of and I need to use this as a filter in a dataset.  I've tried using this variable as shown in the query below but I'm getting an error "The expression used for the parameter 'Unit_Permissions"
    in the dataset "Unit_Permissions" includes a variable reference.  Variable values cannot be used in query parameter expressions."  Is there another way I should go about doing this?   
    = "SELECT UnitCode, UnitName " &
      "FROM dbo.VW_Unit_Permissions " &
      "WHERE UserId in (" & Variables!ADAuthorizations.Value & ")" &
      "ORDER BY UnitName "
    Thanks,
    Robert

    Please follow below steps,
    1. Create a custom code to get all the users in an array,
    Public Function getUserName() As String()
       dim Users(1) as string
       Users(0) = "user1"
       Users(1) = "user2"
    return Users
    End Function
    2. Create dataset using the below query,
    SELECT UnitCode, UnitName FROM dbo.VW_Unit_Permissions ORDER BY UnitName
    3. Add a parameter @User and set properties : (Datatype as text, Allow multiple values, Visible)
    Under "Available Values" select specify values and set the label and values as expression.
    =Code.getUserName()
    4. Similarly for "Default values" as
    =Code.getUserName()
    5. Go to tablix properties and select the filter tab and set the properties as below,
    - Select Expression "UserId" i.e =Fields!UserId.Value
    - Operator as "IN"
    - Value as =Parameters!User.Value
    6. Preview the report.
    Regards, RSingh

  • Using a variable value in CDATA for generating an XML type in Oracle

    Hello,
    I have prepared a function given below where I have some input variables & I have to generate one XML with those input variables as tag attribute value:
    create or replace function NEW_PROJECT_DETAILS
    ( p_ReferenceId in varchar2 ,
    p_Project_No in varchar2,
    p_Project_Name in varchar2,
    p_Project_Desc in varchar2 ,
    p_Project_Type in varchar2,
    p_Project_Location in varchar2,
    p_Project_Status in varchar2 )
    return xmltype
    as
    payload xmltype;
    begin
    dbms_output.put_line('Payload Started');
    payload:= xmltype('<?xml version="1.0" encoding="UTF-8"?>
    <ProjectDetails>
    <RefID>'||p_ReferenceId||'</RefID>
    <ProjectNo>'||p_Project_No||'</ProjectNo>
    <ProjectName>'||p_Project_Name||'</ProjectName>
    <ProjectDesc>'||p_Project_Desc||'</ProjectDesc>
    <ProjectType>'||p_Project_Type||'</ProjectType>
    <ProjectLocation><![CDATA[p_Project_Location]]></ProjectLocation>
    /* <ProjectLocation>'||p_Project_Location||'</ProjectLocation> */
    <ProjectStatus>'||p_Project_Status||'</ProjectStatus>
    </ProjectDetails>');
    dbms_output.put_line('Payload Comp1');
    return payload;
    end;
    This procedure works absolutely fine.
    Now the problem which I am having is that the variable p_Project_Location has value like "6747:BBO&M SBV".
    Due to the '*&*' in that value I have to use CDATA. But i dont know how to pass this variable directly in the CDATA in the XML.
    Please help me with this asap.
    Thanks & Regards,
    Divya Aggarwal
    Edited by: 784414 on Dec 2, 2010 4:15 AM
    Edited by: 784414 on Dec 2, 2010 4:16 AM

    Hi,
    If you absolutely want to use a CDATA section, then :
    payload:= xmltype('<?xml version="1.0" encoding="UTF-8"?>
    <ProjectDetails>
    <RefID>'||p_ReferenceId||'</RefID>
    <ProjectNo>'||p_Project_No||'</ProjectNo>
    <ProjectName>'||p_Project_Name||'</ProjectName>
    <ProjectDesc>'||p_Project_Desc||'</ProjectDesc>
    <ProjectType>'||p_Project_Type||'</ProjectType>
    <ProjectLocation><![CDATA['||p_Project_Location||']]></ProjectLocation>
    <ProjectStatus>'||p_Project_Status||'</ProjectStatus>
    </ProjectDetails>');Alternatively, you can escape non valid characters with DBMS_XMLGEN.CONVERT, e.g. :
    payload:= xmltype('<?xml version="1.0" encoding="UTF-8"?>
    <ProjectDetails>
    <RefID>'||p_ReferenceId||'</RefID>
    <ProjectNo>'||p_Project_No||'</ProjectNo>
    <ProjectName>'||p_Project_Name||'</ProjectName>
    <ProjectDesc>'||p_Project_Desc||'</ProjectDesc>
    <ProjectType>'||p_Project_Type||'</ProjectType>
    <ProjectLocation>'||dbms_xmlgen.convert(p_Project_Location)||'</ProjectLocation>
    <ProjectStatus>'||p_Project_Status||'</ProjectStatus>
    </ProjectDetails>');which outputs :
    <?xml version="1.0" encoding="UTF-8"?>
    <ProjectDetails>
    <RefID>1</RefID>
    <ProjectNo>1</ProjectNo>
    <ProjectName>PRJ1</ProjectName>
    <ProjectDesc>This is project 1</ProjectDesc>
    <ProjectType>P</ProjectType>
    <ProjectLocation>6747:BBO&amp;M SBV</ProjectLocation>
    <ProjectStatus>S</ProjectStatus>
    </ProjectDetails>Any basic XML parser should then convert back escaped characters when processing the document.
    You can also use SQL/XML functions, which will take care of that automatically.
    For example :
    SELECT appendChildXML(
            XMLType('<?xml version="1.0" encoding="UTF-8"?><ProjectDetails/>'),
            XMLForest(
             '1'                 as "RefID",
             '1'                 as "ProjectNo",
             'PRJ1'              as "ProjectName",
             'This is project 1' as "ProjectDesc",
             'P'                 as "ProjectType",
             '6747:BBO&M SBV'    as "ProjectLocation",
             'S'                 as "ProjectStatus"
    FROM dual;or,
    SELECT appendChildXML(
            XMLType('<?xml version="1.0" encoding="UTF-8"?><ProjectDetails/>'),
            XMLForest(
             '1'                 as "RefID",
             '1'                 as "ProjectNo",
             'PRJ1'              as "ProjectName",
             'This is project 1' as "ProjectDesc",
             'P'                 as "ProjectType",
             XMLCData('6747:BBO&M SBV') as "ProjectLocation",
             'S'                 as "ProjectStatus"
    FROM dual;

  • How to select several values from a user exit variable in a planning folder

    Hello,
    I have created a user exit variable for limiting the values only to which the user need to access.
    For a simulation part, it is then necessary for him to select several values from these values (not only one, and not all)
    But It seems in this case the user has only two possibilities :
    - keep all the values without any restriction
    - restrain the selection to only one value.
    It seems possible for the user to access to a multiple choice window, but this possibility doesn't seems to work : in all tests we did, only the first value was taken into account by BPS.
    If this method is not good do you know an other manner to permit the user to choice several values amongst a set of pre-selected  (because the original set is too important) values ?
    Thanks for your help.

    Hi Mayank,
    Thanks for your response, but I don't think it corresponds to my problem.
    I my case, I use a user exit variable to filter some data. It seems BPS offers the possibility to the user to select several values amongts the pre-selected values presented by the user exit variable, but it doesn't work. We can use a popup in which we enters the required values, but in final, only the first value is taken into account.
    I don't know if it is due to a BPS bug or if it is not a good solution in regard to BPS philosophy. In this case, the concerned caracteristic isn't in the header but in lead columns.
    I must present a solution to my client next monday, so I have not enough time to open an OSS message.
    An alternate solution should be interesting too.
    My need is to present to a user a selection of values amongst all values from an infoobject (the user exit variable seemed to be a good solution) and the user must have the possibility to select some values amongst these as filter.
    Regards

  • Bind Variable in SELECT statement and get the value  in PL/SQL block

    Hi All,
    I would like  pass bind variable in SELECT statement and get the value of the column in Dynamic SQL
    Please seee below
    I want to get the below value
    Expected result:
    select  distinct empno ,pr.dept   from emp pr, dept ps where   ps.dept like '%IT'  and pr.empno =100
    100, HR
    select  distinct ename ,pr.dept   from emp pr, dept ps where   ps.dept like '%IT'  and pr.empno =100
    TEST, HR
    select  distinct loc ,pr.dept   from emp pr, dept ps where   ps.dept like '%IT'  and pr.empno =100
    NYC, HR
    Using the below block I am getting column names only not the value of the column. I need to pass that value(TEST,NYC..) into l_col_val variable
    Please suggest
    ----- TABLE LIST
    CREATE TABLE EMP(
    EMPNO NUMBER,
    ENAME VARCHAR2(255),
    DEPT VARCHAR2(255),
    LOC    VARCHAR2(255)
    INSERT INTO EMP (EMPNO,ENAME,DEPT,LOC) VALUES (100,'TEST','HR','NYC');
    INSERT INTO EMP (EMPNO,ENAME,DEPT,LOC) VALUES (200,'TEST1','IT','NYC');
    INSERT INTO EMP (EMPNO,ENAME,DEPT,LOC) VALUES (300,'TEST2','MR','NYC');
    INSERT INTO EMP (EMPNO,ENAME,DEPT,LOC) VALUES (400,'TEST3','HR','DTR');
    INSERT INTO EMP (EMPNO,ENAME,DEPT,LOC) VALUES (500,'TEST4','HR','DAL');
    INSERT INTO EMP (EMPNO,ENAME,DEPT,LOC) VALUES (600,'TEST5','IT','ATL');
    INSERT INTO EMP (EMPNO,ENAME,DEPT,LOC) VALUES (700,'TEST6','IT','BOS');
    INSERT INTO EMP (EMPNO,ENAME,DEPT,LOC) VALUES (800,'TEST7','HR','NYC');
    COMMIT;
    CREATE TABLE COLUMNAMES(
    COLUMNAME VARCHAR2(255)
    INSERT INTO COLUMNAMES(COLUMNAME) VALUES ('EMPNO');
    INSERT INTO COLUMNAMES(COLUMNAME) VALUES ('ENAME');
    INSERT INTO COLUMNAMES(COLUMNAME) VALUES ('DEPT');
    INSERT INTO COLUMNAMES(COLUMNAME) VALUES ('LOC');
    COMMIT;
    CREATE TABLE DEPT(
    DEPT VARCHAR2(255),
    DNAME VARCHAR2(255)
    INSERT INTO DEPT(DEPT,DNAME) VALUES ('IT','INFORMATION TECH');
    INSERT INTO DEPT(DEPT,DNAME) VALUES ('HR','HUMAN RESOURCE');
    INSERT INTO DEPT(DEPT,DNAME) VALUES ('MR','MARKETING');
    INSERT INTO DEPT(DEPT,DNAME) VALUES ('IT','INFORMATION TECH');
    COMMIT;
    PL/SQL BLOCK
    DECLARE
      TYPE EMPCurTyp  IS REF CURSOR;
      v_EMP_cursor    EMPCurTyp;
      l_col_val           EMP.ENAME%type;
      l_ENAME_val       EMP.ENAME%type;
    l_col_ddl varchar2(4000);
    l_col_name varchar2(60);
    l_tab_name varchar2(60);
    l_empno number ;
    b_l_col_name VARCHAR2(255);
    b_l_empno NUMBER;
    begin
    for rec00 in (
    select EMPNO aa from  EMP
    loop
    l_empno := rec00.aa;
    for rec in (select COLUMNAME as column_name  from  columnames
    loop
    l_col_name := rec.column_name;
    begin
      l_col_val :=null;
       l_col_ddl := 'select  distinct :b_l_col_name ,pr.dept ' ||'  from emp pr, dept ps where   ps.dept like ''%IT'' '||' and pr.empno =:b_l_empno';
       dbms_output.put_line('DDL ...'||l_col_ddl);
       OPEN v_EMP_cursor FOR l_col_ddl USING l_col_name, l_empno;
    LOOP
        l_col_val :=null;
        FETCH v_EMP_cursor INTO l_col_val,l_ename_val;
        EXIT WHEN v_EMP_cursor%NOTFOUND;
          dbms_output.put_line('l_col_name='||l_col_name ||'  empno ='||l_empno);
       END LOOP;
    CLOSE v_EMP_cursor;
    END;
    END LOOP;
    END LOOP;
    END;

    user1758353 wrote:
    Thanks Billy, Would you be able to suggest any other faster method to load the data into table. Thanks,
    As Mark responded - it all depends on the actual data to load, structure and source/origin. On my busiest database, I am loading on average 30,000 rows every second from data in external files.
    However, the data structures are just that - structured. Logical.
    Having a data structure with 100's of fields (columns in a SQL table), raise all kinds of questions about how sane that structure is, and what impact it will have on a physical data model implementation.
    There is a gross misunderstanding by many when it comes to performance and scalability. The prime factor that determines performance is not how well you code, what tools/language you use, the h/w your c ode runs on, or anything like that. The prime factor that determines perform is the design of the data model - as it determines the complexity/ease to use the data model, and the amount of I/O (the slowest of all db operations) needed to effectively use the data model.

Maybe you are looking for

  • ACS will not save the config changes to reports

    I have configured a very old ACS appliance, 4.1.  At this time this is what I we have to use.   The authentication is working fine, the reports for accounting, TACACS+ accounting is only saving the login and logout of the users and not any config cha

  • Authorization for putting the values in Plant

    Hi, I have a requirement from my Project team that in Project Builder ,the Finance people should only have the right to put in the Plant values at the various levels of Project hierarchy.The other fields should be in display for the Finance people. A

  • Nokia C3 - unable to delete call log and some mess...

    Hi, I wonder if you can help me, I have tried to delete my call log from my phone however I get an "invalid selection" error message.  The logs do not have any time and date next to the names and I am unable to delete.  Also I have tried to delete so

  • Ion3 makepkg error [solved]

    Hi, i hope you can help me with my problem, i got the PKGBUILD file from the AUR, and tried to make a package to install, but makepkg allways ends, saying make[2]: Entering directory `/var/abs/local/src/ion-3ds-20050406/utils/ion-completefile' make[2

  • How to "save as" in Preview?

    I recently upgraded to Mountain Lion, which apparently has also resulted in changes to Preview. Now there is no "save as". How the heck am I supposed to save an altered copy of an image? I don't want to save the alterations on the original image!