Passing date to procedure help

Hello, this maybe simple question, but I couldn't figure out why I am getting
ORA-01843: not a valid month.. Here is what I did:
exec proc(to_date('01/01/2007','MM/DD/YYYY'),to_date(01/30/2007,'MM/DD/YYYY'))NLS setting is: DD-MON-RR
procedure proc (date1 in date, date2 in date)
v_date_period varchar2;
select date_period into v_date_period from t1 where start_date = to_date(date1,'MM/DD/YYYY') and end_date = to_date(date2,'MM/DD/YYYY');
start_date and end_date are in date MM/DD/YYYY format in the table, but the above code is failed b/c of the above error.
One thing I noticed that when dates are passed into the procedure, they come in DD-MON-RR format and the comparion never works in cursor. start_date and end_date are in MM/DD/YYYY format. but it works only when to_date(date1,'DD-MON-RR') and to_date(date2,'DD-MON-RR'). How is it working when start_date and end_date are in MM/DD/YYYY format???
another question is, when I say To_date, does it always convert any date to NLS setting? I used
to_date('01/01/2007', 'dd/mm/yyyy'), but it doesn't have any effect when it goes to the procedure.. still comes as DD-MON-RR.
what mistake i am doing? I would appreciate your ans. Thanks,

I think I got it now. I really didn't need that extra
conversion within the procedure. It works now. Then let's make sure it's clear for you.
You are right to consider the NLS_DATE_FORMAT settings, that's good, as most people are unaware of it and really have no understanding whatsoever as to what it does. Perhaps your understanding of it is not quite up to scratch just yet...
The setting relates to how oracle converts between dates and strings when no format is specified explicitly. e.g.
SQL> select to_char(sysdate) from dual;
TO_CHAR(SYSDATE)
04/03/2008 10:00:11
SQL> alter session set nls_date_format = 'YYYY MON DD';
Session altered.
SQL> select to_char(sysdate) from dual;
TO_CHAR(SYS
2008 MAR 04
SQL> select to_char(sysdate, 'DD/MM/YYYY') from dual;
TO_CHAR(SY
04/03/2008
SQL>Likewise if you convert the other way from a string to a date...
Firstly with implicit conversion, which will assume the NLS_DATE_FORMAT setting format for the string...
SQL> select to_date('2008 JAN 01') from dual;
TO_DATE('20
2008 JAN 01And then if you explicitly convert specifying the format...
SQL> select to_date('01/01/2008','DD/MM/YYYY') from dual;
TO_DATE('01
2008 JAN 01However if you try and implicitly convert (using the NLS setting) but the string isn't of the correct format...
SQL> select to_date('01/01/2008') from dual;
select to_date('01/01/2008') from dual
ERROR at line 1:
ORA-01843: not a valid month
SQL>So now let's look at what you were doing...
select date_period into v_date_period
from t1
where start_date = to_date(date1,'MM/DD/YYYY')
and end_date = to_date(date2,'MM/DD/YYYY');Your date1 and date2 are already of a DATE datatype. This means that they are already stored in the oracle internal date format. Note: ALL dates are stored the same internally regardless of how they are displayed. e.g.
SQL> select sysdate, dump(sysdate) from dual;
SYSDATE
DUMP(SYSDATE)
04/03/2008 10:35:20
Typ=13 Len=8: 216,7,3,4,10,35,20,0
SQL> alter session set nls_date_format = 'YYYY MON DD HH24:MI'
  2  ;
Session altered.
SQL> select sysdate, dump(sysdate) from dual;
SYSDATE
DUMP(SYSDATE)
2008 MAR 04 10:36
Typ=13 Len=8: 216,7,3,4,10,36,50,0
SQL>However, you are using the to_date function. This expects the first parameter to be a string and the second parameter is an optional string specifying the format of the first string.
So it was expecting:
to_date(<string>,<string>)and you gave it
to_date(<date>,<string>)When oracle comes across this sort of thing, rather than produce an error it recognises that it is able to do an implicit conversion of datatypes so internally it is doing
to_date(to_char(<date>),<string>)Note: because it is an implicit conversion within the "to_char" it is using the NLS settings to do this.
You said your NLS setting was DD-MON-RR, so this is the same as...
to_date(to_char(<date>,'DD-MON-RR'),<string>)Now look at your code again with the implicit conversions in place...
select date_period into v_date_period
from t1
where start_date = to_date(to_char(date1,'DD-MON-RR'),'MM/DD/YYYY')
and end_date = to_date(to_char(date2,'DD-MON-RR'),'MM/DD/YYYY');Hmmm, so the to_date function is getting it's first parameter as a string in the format 'DD-MON-RR' and the second parameter is telling it that the first parameter is in the format 'MM/DD/YYYY'.
The two dates you passed were:
'01/01/2007'
and
'01/30/2007'
But after the implicit conversion your code looks like...
select date_period into v_date_period
from t1
where start_date = to_date('01-JAN-07','MM/DD/YYYY')
and end_date = to_date('30-JAN-07','MM/DD/YYYY');As you can see there are numerous problems with this. The first one Oracle errored on was the fact that 30 is not a valid Month as defined by your format string.
Hopefully that clarifies things a little more for you and you'll understand a little more about the differences between strings, dates and implicit and explicit conversion between the two using format strings and the NLS setting.
;)

Similar Messages

  • Help understanding how to pass dates to procedures in a package?

    When I run the following script in SQL*Plus, I get no obvious errors, but the truncate does not happen and all the other processing doesn't happen. I ran a similar version in another tool and it worked. Much of the code is deleted here but I believe I don't fully understand passing dates in the procedure. I figure if one of the dates ends up null or something invalid, the procedure will run and give no results. If someone could correct me on how to pass variables, it would help greatly. As you can see, I am passing 2 dates in from an ACCEPT statement, passing them to 1 shell type procedure which runs other procedures and passes the dates to the procedures below it. This procedures calls the 3rd procedure and passes the same dates to it:
    ACCEPT CUR_PERIOD PROMPT 'Current Period (MM/DD/YYYY): ';
    ACCEPT PRIOR_PERIOD PROMPT 'Prior Period (MM/DD/YYYY): ';
    EXEC RCO.MONTH_END_PACK_1.MONTHENDPHASE1PROC('&CUR_PERIOD','&PRIOR_PERIOD');
    The spec looks like this:
    CREATE OR REPLACE PACKAGE MONTH_END_PACK_1 AS
         PROCEDURE MonthEndPhase1PROC(get_cur_period IN DATE, get_prior_period IN DATE);
         PROCEDURE W_CAT_INFO_RPT_PROC(GET_CUR_PERIOD IN DATE, GET_PRIOR_PERIOD IN DATE);
         PROCEDURE WO_CAT_INFO_RPT_PROC(GET_CUR_PERIOD IN DATE, GET_PRIOR_PERIOD IN DATE);
    END MONTH_END_PACK_1;
    The body looks like this:CREATE OR REPLACE PACKAGE BODY MONTH_END_PACK_1  AS
    PROCEDURE MonthEndPhase1PROC(get_cur_period IN DATE, get_prior_period IN DATE) IS
         BEGIN
              EXECUTE IMMEDIATE 'TRUNCATE TABLE RPT_DS1_CNT';
              EXECUTE IMMEDIATE 'TRUNCATE TABLE RPT_DS1_CNT_CAT';
              W_CAT_INFO_RPT_PROC(GET_CUR_PERIOD, GET_PRIOR_PERIOD);
         END;
    PROCEDURE W_CAT_INFO_RPT_PROC(GET_CUR_PERIOD IN DATE, GET_PRIOR_PERIOD IN DATE) IS
         CUR_PERIOD DATE;
         PRIOR_PERIOD DATE;
         BEGIN
              -- Assign the dates to this procedure that were passed in above.
              CUR_PERIOD := GET_CUR_PERIOD;         --07/27/2007
              PRIOR_PERIOD := GET_PRIOR_PERIOD;     --06/27/2007
              -- Execute stored procedure, passing in dates.
              WO_CAT_INFO_RPT_PROC(CUR_PERIOD, PRIOR_PERIOD);
              -- Other code goes here
         END; -- W_CAT_INFO_RPT_PROC
    PROCEDURE WO_CAT_INFO_RPT_PROC(GET_CUR_PERIOD IN DATE, GET_PRIOR_PERIOD IN DATE) IS
         CUR_PERIOD DATE;
         PRIOR_PERIOD DATE;
         BEGIN
              CUR_PERIOD := GET_CUR_PERIOD;
              PRIOR_PERIOD := GET_PRIOR_PERIOD;
              INSERT INTO RPT_DS1_CNT
              (select distinct trim(CVBI_KEY) as CVBI_KEY, vendor_id
              from
              (select m.cvbi_key, v.vendor_name
              from  rco.cogs_resource m,RCO.COGS_SRVCTYP st,rco.cogs_mkt ms,RCO.COGS_VENDOR v,
                (select distinct cvbi_key, vendor_id
                 from RCO.COGS_resource
                 where period = CUR_PERIOD)ak
              where  ak.cvbi_key = m.cvbi_key
              and  trim(m.cvbi_key) = trim(st.cvbi_key(+))
              and  period = CUR_PERIOD));
         END;
    END;
    /

    EXEC RCO.MONTH_END_PACK_1.MONTHENDPHASE1PROC(to_date('&CUR_PERIOD','MM/DD/YYYY'),to_date('&PRIOR_PERIOD','MM/DD/YYYY'));
    As you can see, I am passing 2 dates in from an ACCEPT statementUntil you convert them using TO_DATE they are just strings
    Message was edited by:
    3360
    Fixed date formats

  • Passing Date to procedure give Problem

    heloo...
    I have two database schema, And both schema contain same procedure with Date as argument.
    that procedure workes well in one schema but it give error of "INVALID MONTH" in another schema.
    Any sollution of this?
    Thanks

    Why it is working fine in one schema and it give error in another schema? You did not post the most important part of your problem (how are you calling this procedure), but as indicated, if you are passing a string that looks like a DATE, then it can be converted to a date only using the database implicit conversion logic that will rely on NLS seetings (and those can well be different for the two users).
    See replies above on how to fix this.

  • Passing date to procedure

    Hi All,
    I have one scenario where I have to fetch the data from multiple tables and write it onto the spool file like.
    set pagesize 9999
    create or replace procedure p1 as
    sd date:='&Start_date';
    ed date:='&End_date';
    a number;
    b number;
    c number;
    d number;
    e number;
    f number;
    begin
    SELECT COUNT(BARNO) into a FROM DGP;
    SELECT COUNT(DISTINCT(NO)) into b FROM LOG WHERE OPERATION_DATE between sd and ed AND (OPERATION_TYPE='B');
    SELECT COUNT(DISTINCT(NO)) into c FROM LOG WHERE OPERATION_TYPE='UNBARRED' AND OPERATION_DATE between sd and ed;
    SELECT COUNT(DISTINCT(NO)) into d FROM LOG WHERE OPERATION_DATE between sd and ed AND MODE ='AUTO' AND OPERATION_TYPE ='B';
    SELECT COUNT(DISTINCT(NO)) into e FROM LOG WHERE OPERATION_DATE between sd and ed AND MODE ='AUTO' AND OPERATION_TYPE='UB';
    SELECT COUNT(DISTINCT(NO)) into f FROM LOG WHERE OPERATION_DATE between sd and ed AND MODE ='MANUAL' AND OPERATION_TYPE='B';
    dbms_output.put_line(a||' '||b||' '||c||' '||d||' '||e||' '||f);
    end;
    The above procedure asks me the date during the creation of the procedure, whereas my requirement is during the execution of the procedure it should ask me the date and that too only once.
    Pls suggest.

    create or replace procedure p1 (sd in date
                                   ,ed in date
    as
       a number;
       b number;
       c number;
       d number;
       e number;
       f number;
    begin
       select COUNT(BARNO) into a FROM DGP;
       SELECT COUNT(DISTINCT(NO)) into b FROM LOG WHERE OPERATION_DATE between sd and ed AND (OPERATION_TYPE='B');
       SELECT COUNT(DISTINCT(NO)) into c FROM LOG WHERE OPERATION_TYPE='UNBARRED' AND OPERATION_DATE between sd and ed;
       SELECT COUNT(DISTINCT(NO)) into d FROM LOG WHERE OPERATION_DATE between sd and ed AND MODE ='AUTO' AND OPERATION_TYPE ='B';
       SELECT COUNT(DISTINCT(NO)) into e FROM LOG WHERE OPERATION_DATE between sd and ed AND MODE ='AUTO' AND OPERATION_TYPE='UB';
       SELECT COUNT(DISTINCT(NO)) into f FROM LOG WHERE OPERATION_DATE between sd and ed AND MODE ='MANUAL' AND OPERATION_TYPE='B';
       dbms_output.put_line(a||' '||b||' '||c||' '||d||' '||e||' '||f);
    end;
    /create it once and call it like
    begin
       p1 (sysdate, sysdate + 1); -- pass parameters
    end;
    /and don't forget to
    set serveroutput onotherwise you won't see output from DBMS_OUTPUT
    Edited by: Alex Nuijten on Jul 14, 2009 1:16 PM

  • Pass Parmeter To Sql Data Base Procedure

    Hi,
    i used JDEVADF_11.1.1.4.0
    I have two fields Date type on the Page, and I have a Procedure database gives difference between two dates, on the road to send the values of the two date , and give me the number of days
    I make a call the Procedure in AppModuleImpl
    How can I send the parameter two dates from the screen to data base Procedure , for run the Procedure

    Hi,
    Bind the dates value to the bean and call the IMPL method with help of these value passed as argument .
    The IMPL method must exposed as client interface so that bean can access that method.
    @Gunanidhi

  • Error while passing date parameters in procedure and commit issue

    Hi
    1) I am doing a archiveing records and pls find my code below and i have couple of issue,pls find my code and want to ensure the commit is happening every 100000 rows inserted but i am archeiving a huge table but when i checks the table frequently it shows 0 records and after it shows count the actual rows around 20 million records.How can i ensure it commiting on every 100000 records. pls find my code my db version is 10g on windows
    CREATE OR REPLACE PROCEDURE doins as
    cnt number:=0;
    FOR x IN (select * from Call_log
    where trunc(c_date) = to_date('11-Aug-2008','DD-MON-YYYY'))
    LOOP
    INSERT INTO call_arch
    select * from Call_log
    where trunc(c_date) = to_date('11-Aug-2008','DD-MON-YYYY');
    cnt := cnt + 1;
    IF( cnt = 10000 )
    THEN
    cnt := 0;
    commit;
    END IF;
    commit;
    END LOOP;
    2) Error while passing date as parameter i am getting following errors while passing date parameter pls find my code and errors
    CREATE OR REPLACE PROCEDURE doins(p_date date) as
    cnt number:=0;
    begin
    FOR x IN (select * from Call_log
    where trunc(c_date) = to_char(p_date,'DD-MON-YYYY'))
    LOOP
    INSERT INTO call_arch
    select * from Call_log
    where trunc(c_date) = to_char(p_date,'DD-MON-YYYY');
    cnt := cnt + 1;
    IF( cnt = 10000 )
    THEN
    cnt := 0;
    commit;
    END IF;
    commit;
    END LOOP;
    end;
    exec doins(11-Aug-2008) then gives
    SQL> exec doins(11-Aug-2008);
    BEGIN doins(11-Aug-2008); END;
    ERROR at line 1:
    ORA-06550: line 1, column 16:
    PLS-00201: identifier 'AUG' must be declared
    ORA-06550: line 1, column 7:
    PL/SQL: Statement ignored
    if i gave exec doins(11-08-2008) it gaves
    ERROR at line 1:
    ORA-06550: line 1, column 7:
    PLS-00306: wrong number or types of arguments in call to 'DOINS'
    ORA-06550: line 1, column 7:
    PL/SQL: Statement ignored
    rgds
    rosh

    CREATE OR REPLACE PROCEDURE doins(p_date varchar2) as
    cnt number:=0;
    begin
    FOR x IN (select A.rowid,A.* from Call_log A
    where trunc(c_date) = to_date(p_date,'DD-MON-YYYY'))
    --hope that's c_date columne is   DATE datatype
    LOOP
    INSERT INTO call_arch
    select * from Call_log
    where rowid=x.rowid;
    cnt := cnt + 1;
    IF( cnt = 10000 )
    THEN
    cnt := 0;
    commit;
    END IF;
    commit;
    END LOOP;
    end;
    thats your correct procedure - but NOT CORRECT ISSUE.
    You should use bulk collect with limit clause and forall clause to do it faster!!! Or Merge clause.

  • Passing data from Oracle stored procedures to Java

    We're going to write a new web interface for a big system based on Oracle database. All business rules are already coded in PL/SQL stored procedures and we'd like to reuse as much code as possible. We'll write some new stored procedures that will combine the existing business rules and return the final result dataset.
    We want to do this on the database level to avoid java-db round trips. The interface layer will be written in Java (we'd like to use GWT), so we need a way of passing data from Oracle stored procedures to Java service side. The data can be e.g. a set of properties of a specific item or a list of items fulfilling certain criteria. Would anyone recommend a preferable way of doing this?
    We're considering one of the 2 following scenarios:
    passing objects and lists of objects (DB object types defined on the schema level)
    passing a sys_refcursor
    We verified that both approaches are "doable", the question is more about design decision, best practice, possible maintenance problems, flexibility, etc.
    I'd appreciate any hints.

    user1754151 wrote:
    We're going to write a new web interface for a big system based on Oracle database. All business rules are already coded in PL/SQL stored procedures and we'd like to reuse as much code as possible. We'll write some new stored procedures that will combine the existing business rules and return the final result dataset.
    We want to do this on the database level to avoid java-db round trips. The interface layer will be written in Java (we'd like to use GWT), so we need a way of passing data from Oracle stored procedures to Java service side. The data can be e.g. a set of properties of a specific item or a list of items fulfilling certain criteria. Would anyone recommend a preferable way of doing this?
    We're considering one of the 2 following scenarios:
    passing objects and lists of objects (DB object types defined on the schema level)
    passing a sys_refcursor
    We verified that both approaches are "doable", the question is more about design decision, best practice, possible maintenance problems, flexibility, etc.
    I'd appreciate any hints.If logic is already written in DB, and the only concern is of passing the result to java service side, and also from point of maintenance problem and flexibility i would suggest to use the sys_refcursor.
    The reason if Down the line any thing changes then you only need to change the arguments of sys_refcursor in DB and as well as java side, and it is much easier and less efforts compare to using and changes required for Types and Objects on DB and java side.
    The design and best practise keeps changing based on our requirement and exisiting design. But by looking at your current senario and design, i personally suggest to go with sys_refcursor.

  • Problem in passing data from 1 screen to another using BBP_DOC_CHANGE_BADI.

    Hi Experts,
    i am new to the SRM, i am facing problem in passing data from one screen to another.
    my requirement is that when we select one shopping cart and press the PROPOSE SOURCES OF SUPPLY button, we will fetch all the contracts that are attached to the shopping cart.
    we have implemented a BADI implementation of BBP_SOS_BADI (method BBP_SOS_CHECK) for passing some changed values to the contracts of the shopping cart into the popup screen that is displayed when we press PROPOSE SOURCES OF SUPPLY button and when we select any contract and press ASSIGN ONLY button in the popup screen the badi BBP_DOC_CHANGE_BADI is triggered.
    i have implemented another BADI implementation of BBP_DOC_CHANGE_BADI for fetching the selected contract and pass the values to another screen, but the problem is that when we select one contract and press the assign only button we are fetching the wrong contract number ( that is in the BADI method BB_SC_CHANGE parameter IT_ITEM we are fetching the wrong contract), if we again do the same procedure for the second time we are getting the correct contract.
    i am unable to understand why we are getting the wrong contract in the first time( that is we are getting contract other than the selected one).
    as per my understanding i think when we are passing data to the popup screen using BBP_DOC_CHANGE_BADI we are not updating the shopping cart with the changed data.
    can anyone tell me how we can update the SHOPPING CART with the changed contracts data, i have used BBP_PD_SC_UPDATE, BBP_PD_SC_SAVE and other shopping cart FM but nothing is happening.
    Thanks
    Tanveer

    Hello,
    What version of SRM are you on?  Have you check for OSS Notes?  I have had trouble with BBP_DOC_CHANGE_BADI but it was because of other issues.  The BADI works pretty well and it is called almost every time something happens to the shopping cart.
    I have noticed that sometimes that values are not changed til the second calling of the BADI.  I have yet understand why but I think it has to do with prompt processing. Usually, we train our requisitioners to click the 'Check'  button to flush things out.
    I don't know if I was helpful.... another thought.... could there be an error caught by BBP_DOC_CHECK_BADI that is preventing change in BBP_DOC_CHANGE_BADI?
    Regards, Dean.

  • Can not pass data after while loop

    Hello.
    I have created a VI for my experiment and am having problem passing data outside a while loop to save on an excel file. The VI needs to first move a probe radially, take data at 1mm increment, then move axially, take data radially at 1mm increment, then move to the next axial position and repeat. It would then export these data to an excel file. The VI is a little complicated but it's the only way I know how to make it for our experiment. I have tested it and all the motion works correctly, however I can not get it to pass the data after the last while loop on the far right of the VI where I have put the arrows (Please see the attached VI ). Is it because I'm using too many sequence, case, and while loops?  If so, what other ways can I use to make it export data to the excel file?
    Any help would be appreciated. 
    Thank you,
    Max
    Attachments:
    B.Dot.Probe.Exp.vi ‏66 KB

    Ummmm .... gee, I'm not even sure where to begin with this one. Your VI is well .... ummmm... You have straight wires! That's always nice to see. As for everything else. Well... Your fundamental problem is lack of understanding of dataflow programming. What you've created is a text program. It would look fantastic in C. In LabVIEW it makes my heart break. For a direct answer to your question: Data will not show up outside a while loop until the while loop has completed. This means your most likely problem is that the conditions to stop that specific loop are not being met. As for what the problem is, I don't even want to start debugging this code. Of course, one way to pass data outside of loops is with local variables, and hey, you seem to be having so much fun with those, what's one more?
    This may sound harsh, and perhaps be somewhat insulting, but the brutal truth is that what I would personally do is to throw it out and to start using a good architecture like a state machine. This kind of framework is easy to code, easy to modify, and easy to debug. All qualities that your code seems to lack.
    Message Edited by smercurio_fc on 08-17-2009 10:00 PM

  • How to pass date parameter from one page to other in BSP application

    Hello gurus,
    In my BSP application i have taken an input field and made its type "date" and its value also of type date and have set showhelp .
    Now once a particular date is given as an input i want to pass its value to next page. And in next page i have to fire a query based on the date entered in previous page...
    Now my prb is that my date value is not getting passed to the next page.
    I have used
    navigation->set_parameter( name = 'BEGDA' value = BEGDA ).
    to pass date parameter.....still parameter is not getting passed.
    plz help me with this.....
    thankx.....

    Hi Eddy,
    By truncation i mean the entire date becomes 10 char including the ' . ' eg(06.12.2006).
    so with begda being 8chars it takes my date as 06.12.200
    as a result my query is not getting executed.
    now i have tried to use a FM  'CONVERT_DATE_TO_INTERN_FORMAT'.
    in my 1st page but still in 2nd page its giving me following error.
    <b>The data that was read could not be written to the specified target field during a SELECT access. Either the conversion is not supported for the type of the target field, or the target field is too short to accept the value, or the data is not in the appropriateformat for the target field.
    </b>
    Regards
    Swati

  • Passing date parameter from prompt

    Hi experts
    I am getting some problem while passing date from a dashboard prompt.
    In RPD i have changed the date column properties as DATE only so that i will get the DATE part of the data not the time stamp.
    Now in the dashboard prompt i added a prompt for the date column.
    I initialized the date prompt with a server variable of sysdate
    when i am running the dashboard i am getting default value in the prompt(04/15/2011)
    when i am changing the date it is selected as(04/15/2011)
    but when i am clicking the 'Go' button the date is converting to 2011-04-15 00:00:00 due to which my report is not running and i am getting error as
    View Display Error
    A date value was expected (received "2011-04-15 00:00:00").
    Error Details
    Error Codes: QABPH2PO
    can anyone help me to pass only date part
    thanks in advance
    regards
    Gourisankar

    Hi J / Srikanth
    Sorry to restart the thread again.
    As we discussed i have downloaded the patch and applied to my windows 32 bit machine.
    But now when i run the report the report is running only for the default value(Server Variable) which is specified to the prompt. when i change the date there is no effect to the report.
    When i drill down to the report i found that the date column(is prompted) is changed to teh server variable name which is might be the cause.
    any input on this???
    regards
    Gourisankar

  • Problem in passing data from one .jsp page to another .jsp page

    i have a problem here
    Actually i have 2 jsp pages. What im trying to do here is actually i want to pass data from the first jsp page to the second for updating
    The first jsp page contains data that user wants to update in the form of table.
    <td><img src = "edit.gif" alt = "edit" border="0" ><td>
    <TD><%= Name %></td>
    <TD><%= rs.getInt("Age") %></td>
    <TD><%= rs.getString("Gender") %></td>
    So this page displays the data that users wants to update plus one image button (edit button). So when user clicks this button, all the data in this page will be brought to the second .jsp page called updatePersonal for updating.
    The problem here is that it is not displaying the existing data in the second .jsp page.
    The second page basically contains forms
    <INPUT TYPE="text" NAME="FirstName" maxlength="30" value = "<%=FirstName%>">
    Can someone please help me. I really dont know what to do..How do i get the data displayed in the text field that is passed from the first .jsp page..thankx in advance

    Please modify below code to:
    td><img src = "edit.gif" alt = "edit" border="0" ><td>
    -----------------modified code
    td><a href="updatePersonal.jsp?FirstName=<%=rs.getString(FirstName")%">&LastName=<%=rs.getString("LastName")%>&Age=<%=rs.getInt("Age")%>&Gender=<%=rs.getString("Gender")%>"><img src = "edit.gif" alt = "edit" border="0" ></a><td>
    I'm sure it works</a>

  • Passing data from an XML object to an itemRenderer

    I'm trying to color the background of a column in a datagrid and have found a sample file that illustrate the concept. However, the sample has data stored in an arrayCollection whereas mine is in an XML object. The problem is that the data in the sample file is apparently automatically passed to the itemRenderer (shown below: note the trace statement). My XML object does not appear to automatically pass data to the itemRenderer. So my questions are:
    1. Is there a simple way to pass data stored in an XML object to an itemRenderer
    or
    2. Should I convert my XML to an arrayCollection? If so, what's the best way to do this-- I've tried the following, but without success:
    <mx:Model id="xmldata" source="example3.xml"/>
      <mx:ArrayCollection id="myAC" source="{ArrayUtil.toArray(xmldata.Example1)}" />
    Here's what the xml looks like:
    <TABLE>
       <EXAMPLE1>
          <difficulty> 0.5 </difficulty>
          <discrimination> 0.7 </discrimination>
          <item> 3 </item>
       </EXAMPLE1>
    </TABLE>  
    Here's the itemRenderer:
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Label xmlns:mx="http://www.adobe.com/2006/mxml">
        <!--
            This item renderer simply extends Label and overrides the updateDisplayList function to
            draw a gradient-filled rectangle. The colors in the gradient are determined from the
            data.
        -->
        <mx:Script>
        <![CDATA[
            import flash.geom.Matrix;
            import flash.display.GradientType;
            import flash.display.Graphics;
            override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void
                super.updateDisplayList(unscaledWidth,unscaledHeight);
                var m:Matrix = new Matrix();
                m.createGradientBox(unscaledWidth,unscaledHeight);
                var g:Graphics = graphics;
                            trace("data.col3="+data.col3)
                var colors:Array = (data.col3 < 2000 ? [0x0000CC,0x0000FF] : [0x00CC00,0x00FF00]);
                g.clear();
                g.beginGradientFill(GradientType.LINEAR, colors, [0.2,0.6], [0,255], m);
                // the rectangle is drawn a little high and a little tall to compensate for the gap
                // the DataGrid introduces between rows.
                g.drawRect(0, -2, unscaledWidth, unscaledHeight+4 );
                g.endFill();
        ]]>
        </mx:Script>
    </mx:Label>

    This sample code should answer your question of how to bring data into the renderer automatically. It comes in via the DataGrid dataProvider and then you refer to it in the renderer as data.XYZ, where XYZ is the field in the XML with the data. See FB 3 help sys on e4x syntax.
    ------------------ mainapp.mxml --------------------
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
      creationComplete="srvc.send();">
      <mx:Script>
        <![CDATA[
          import mx.rpc.events.ResultEvent;
          import mx.collections.XMLListCollection;
          [Bindable] private var xlc:XMLListCollection;
          private function dataHandler(evt:ResultEvent):void{
            xlc = new XMLListCollection(evt.result..EXAMPLE1 as XMLList);
        ]]>
      </mx:Script>
      <mx:HTTPService id="srvc" url="data2.xml" result="dataHandler(event)"
        resultFormat="e4x"/>
      <mx:DataGrid dataProvider="{xlc}">
        <mx:columns>
          <mx:DataGridColumn headerText="Difficulty" dataField="difficulty"/>
          <mx:DataGridColumn headerText="Discrimination" dataField="discrimination"/>
          <mx:DataGridColumn headerText="Item" itemRenderer="MyLabel"/>
        </mx:columns>
      </mx:DataGrid>
    </mx:Application>
    ----------- MyLabel.mxml --------------
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Label xmlns:mx="http://www.adobe.com/2006/mxml">
      <mx:Script>
        <![CDATA[
          import flash.geom.Matrix;
          import flash.display.GradientType;
          import flash.display.Graphics;
          override protected function updateDisplayList(unscaledWidth:Number,
            unscaledHeight:Number):void{
            super.updateDisplayList(unscaledWidth,unscaledHeight);
            this.text = data.col3;
            var m:Matrix = new Matrix();
            m.createGradientBox(unscaledWidth,unscaledHeight);
            var g:Graphics = graphics;
            var colors:Array = (data.col3 < 2000 ? [0x0000CC,0x0000FF] : [0x00CC00,0x00FF00]);
            g.clear();
            g.beginGradientFill(GradientType.LINEAR, colors, [0.2,0.6], [0,255], m);
            g.drawRect(0, -2, unscaledWidth, unscaledHeight+4 );
            g.endFill();
        ]]>
      </mx:Script>
    </mx:Label>
    ------------ data2.xml ----------------
    <?xml version="1.0" encoding="utf8"?>
    <TABLE>
       <EXAMPLE1>
          <difficulty> 0.5 </difficulty>
          <discrimination> 0.7 </discrimination>
          <col3> 3 </col3>
       </EXAMPLE1>
    </TABLE>

  • Passing data from a container to another

    Hi,
    Let's say I have two containers (Container1=application , Container2).  Container1 gets some data from user, perform some database lookup and displays Container2 with the results from database lookup.
    Container1 --(call and display)--> Container2
    Below shows  how I am using a bindable variable in Container1 to pass the data from Container1 to Container2.  Also shows how I display Container2 from Container1.
    <!-- Container1 -->
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
       [Bindable] public var foo:String = "bar";
       private function loginHandler(event:LoginEvent):void
          mycontainer2 = new Container2();
          mycontainer2.name = "mycontainer2";
          this.addChild(mycontainer2);
    </mx:Application>
    I am accessing the data in Container2 as follow:
    <!-- Container2 -->
    {mx.core.Application.application.foo}
    Q1) Is there a better way to pass data from one container to another and access the data?
    Q2) Is this the only way to call and display Container2 from Container1?
    Q3) How can I move back to Container1 from Container2, i.e. Container2 call and display Container1
           Container2 --(back to)--> Container1

    Best practices call for using custom events to share data between components. Here is my Flex 3 Cookbook post on the topic:
    http://cookbooks.adobe.com/index.cfm?event=showdetails&postId=15466
    To switch easily between containers 1 & 2 use a ViewStack, the gold standard for such interaction, and manipulate the selectedIndex or selectedChild property:
    http://livedocs.adobe.com/flex/3/html/help.html?content=navigators_3.html
    If this post answered your question or helped, please mark it as such.

  • Passing data from one bsp application to another

    Hi,
    I have few queries that most of you would have done in ur projects:
    1. I want to pass data from one bsp application to another:
    eg based upon selected row of table view which populates material no and descriprion to another application which open the entire material master data.
    Now, i have both the pages in diff bsp applications in place but unable to pass the selected material code to the second bsp application.
    Had it been two different pages of same application I was able to achieve it with set parameter()
    2. To stop the application from reprcessing the data:
    eg: Suppose I have a bsp page where user fill details of a customer and on submitinng the details a customer is created in background and the entire page is disabled by my code. Even now if the user press refresh (F5) button then another customer gets created in the background. So basically i want to avoid the reprocess of the onSubmit event
    Few lines of sample code would be very helpful.
    Best Regards,
    Saurabh Tripathi

    Hi,
    When I am writing the following code in appl1/page1:
            export abc from transactionID
            to data buffer lv_page_data.
            CALL METHOD CL_BSP_SERVER_SIDE_COOKIE=>SET_SERVER_COOKIE
              EXPORTING
                NAME                  = 'TRANSACTIONID'
                APPLICATION_NAME      = RUNTIME->application_name
                APPLICATION_NAMESPACE = RUNTIME->application_namespace
                USERNAME              = ls_name
                SESSION_ID            = runtime->session_id
                DATA_VALUE            = lv_page_data
                DATA_NAME             = 'lv_page_data'
    and following code in appl2/page2:
      CALL METHOD CL_BSP_SERVER_SIDE_COOKIE=>GET_SERVER_COOKIE
        EXPORTING
          NAME                  = 'TRANSACTIONID'
          APPLICATION_NAME      = RUNTIME->application_name
          APPLICATION_NAMESPACE = RUNTIME->application_namespace
          USERNAME              = ls_name
          SESSION_ID            = runtime->session_id
          DATA_NAME             = 'lv_page_data'
        CHANGING
          DATA_VALUE            = lv_page_data
       IF lv_page_data IS NOT INITIAL.
         IMPORT abc to transactionid
           FROM data buffer lv_page_data.
       ENDIF.
    still the code doesn't work. Please explain and guide
    Best Regards,
    Saurabh Tripathi

Maybe you are looking for

  • Mac keeps crashing and I see this report,can anybody help me?

    Interval Since Last Panic Report:  643482 sec Panics Since Last Report:          1 Anonymous UUID:                    580B87A0-8FAA-4070-8C97-FF1261C02818 Tue Jun 14 13:53:47 2011 panic(cpu 1 caller 0x001AB0FE): Kernel trap at 0x0017f403, type 14=pag

  • External Phone number mask

    I have to enter external phone number masks on a number of different phones. when I do this the number then appears on the top line of the LCD screen, can I stop this?

  • Scientific Notation to Integer?

    I have a string like 1.780657E7 that I need to convert to an integer. I think that might be too big for Integer, so maybe BigInt would be better. Anyway, I can't figure out how to do this! I guess I could write my own method, but I'm sure it's alread

  • Order By Clause - Slows performance

    On 10.2 when adding an order by clause to a query affects performance that returns 6 rows of data. Before: select distinct col1 from table1 Cost: 3,000 Execution Time: less than a second Chooses: Bitmap Index Fast Full Scan Index (BitMap) After: sele

  • Third Party Service Provider

    Does AM 6.3 acting as the Identity Provider, support any third party software that could potentially be installed on the service provider side and that can communicate with AM using SAML? Please let us know if anyone has successfully implemented usin