Initiating a variable in a print statement

Is it possible to initiate a variable in a print statement? Thanks.

huh?
do you mean something like System.out.println(new Fubar());?
If this is your question, then yes, this can be done. If not, you would do well to clarify this terribly vague question.
Edited by: Encephalopathic on Apr 22, 2008 3:46 PM

Similar Messages

  • No output on job step output log with perl's print statement under WINDOWS

    Running a perl script ( ActivePerl 5.8.8.x ) on a remote WINDOWS box through llinux-based EM 10.2.04 deployment procedure, in the EM job step output log I've noticed that the print statement in that perl script displays nothing for array or element from array but displays proper value for any scalar variable. Any clue for this kind of issue ?

    Running a perl script ( ActivePerl 5.8.8.x ) on a remote WINDOWS box through llinux-based EM 10.2.04 deployment procedure, in the EM job step output log I've noticed that the print statement in that perl script displays nothing for array or element from array but displays proper value for any scalar variable. Any clue for this kind of issue ?

  • How to use presentaion variable in the SQL statement

    Is there any special syntax to use a presentation variable in the SQL Statement?
    I am setting a presentation variable (Fscl_Qtr_Var)in the dashboard prompt.
    If i set the filter as ADD->VARIABLE->PRESENTATION, it shows the statement as 'Contract Request Fiscal Quarter is equal to / is in @{Fscl_Qtr_Var} '.
    And this works fine but when i convert this to SQL, it returns
    "Contract Request Date"."Contract Request Fiscal Quarter" = 'Fscl_Qtr_Var'
    And this does not work.It is not being set to the value in the prompt.
    I need to combine this condition with other conditions in the SQL Statement. Any help is appreciated. Thanks

    Try this: '@{Fscl_Qtr_Var}'

  • Using a number variable in an SQL statement

    Hi,
    I am trying to use a variable in an sql statement and I have run into problems when the variable is a number. The following line of code works if the variable is a string but not if it is a number.
    "SELECT TOP 1 UUT_STATUS FROM UNIT_UUT_RESULT WHERE UnitID =  '" + Locals.LocalUnitID + "' ORDER BY START_DATE_TIME DESC"
    Is there a difference in the use of the single and double quotes and the + sign for number variables?
    Thanks
    Stuart
    Solved!
    Go to Solution.

    Hi Stuart,
    I am assuming that the UnitID is stored as a numeric in the database? If so, the proper SQL syntax for comparing with numerics should not use a single quote (or any quotes for that matter). The quotes are used only for strings.
    So you would want to use:
    "SELECT TOP 1 UUT_STATUS FROM UNIT_UUT_RESULT WHERE UnitID =  " + Locals.LocalUnitID + " ORDER BY START_DATE_TIME DESC"
    This is really more of an SQL question universal to all languages, not just TestStand.
    Here is an excellent resource that you can consult:
    http://www.w3schools.com/sql/sql_where.asp
    Jervin Justin
    NI TestStand Product Manager

  • Print statement in JSP page after redirection

    Hi,
    I have written a JSP page and in that i am redirecting it to another page. Now after redirection i am printing a statement on the console. It is getting printed whereas when i am printing the same on the browser i am not able to print that. Please can any one tell me the difference between printing the same on the console and browser.
    My first JSP page(one.jsp)
    <%
         response.sendRedirect("two.jsp");
         out.println("After redirect");
         System.out.println("After out");
    %>
    My second JSP(two.jsp)
    <%
         out.println("In two.jsp");
    %>
    Thanks in advance
    regards
    Prashanth

    The sendRedirect sets a code in the HTTP response being sent to the client (I believe it is a 302 code but I am not sure off hand) and then proceeds to process the rest of the JSP on the server which is why the print statement shows up in the console.
    The out.println writes to the HTTP response output stream. The client gets the response and sees the HTTP Header code telling it to make a new request so it stops processing the response message and sends a new request message which is why the out.println message is not seen in the browser.

  • Variable within an import statement

    I'm wanting to have a variable in an import statement for different versions of a class
    example - import someclass.VERSION.*;
    but I want VERSION to be a variable that I can modify for every project that uses the class I'm importing from. I have not found any examples that have done this thus far.

    The point of my suggestion was that it would make it unnecessary to change anything at all for compiling different versions.
    make 3
    Making version 3.0 <<<See how easy that can be? Reading the version of the class to load from an external class file and dynamically loading it is tantamount to a Rube Goldberg machine. Also, you still have to change a file, your properties file. If your project grows to any significant size, this approach will cause you serious headaches.

  • How to use bind variable in this select statement

    Hi,
    I have created this procedure where table name and fieldname is variable as they vary, therefore i passed them as parameter. This procedure will trim leading (.) if first five char is '.THE''. The procedure performs the required task. I want to make select statement with bind variable is there any possibility to use a bind variable in this select statement.
    the procedure is given below:
    create or replace procedure test(tablename in varchar2, fieldname IN varchar2)
    authid current_user
    is
    type poicurtype is ref cursor;
    poi_cur poicurtype;
    sqlst varchar2(250);
    THEVALUE NUMBER;
    begin
         sqlst:='SELECT EMPNO FROM '||TABLENAME||' WHERE SUBSTR('||FIELDNAME||',1,5)=''.THE ''';
         DBMS_OUTPUT.PUT_LINE(SQLST);
    OPEN POI_CUR FOR SQLST ;
    LOOP
         FETCH POI_CUR INTO THEVALUE;
              EXIT WHEN POI_CUR%NOTFOUND;
              DBMS_OUTPUT.PUT_LINE(THEVALUE);
              SQLST:='UPDATE '||TABLENAME|| ' SET '||FIELDNAME||'=LTRIM('||FIELDNAME||',''.'')';
              SQLST:=SQLST|| ' WHERE EMPNO=:X';
              DBMS_OUTPUT.PUT_LINE(SQLST);
                   EXECUTE IMMEDIATE SQLST USING THEVALUE;
    END LOOP;
    COMMIT;
    END TEST;
    Best Regards,

    So you want to amend each row individually? Is there some reason you're trying to make this procedure run as slow as possible?
    create or replace procedure test (tablename in varchar2, fieldname in varchar2)
    authid current_user
    is
       sqlst      varchar2 (250);
       thevalue   number := 1234;
    begin
       sqlst := 'update ' || tablename || ' set ' || fieldname || '= ltrim(' || fieldname || ',''.'')  where substr(' || fieldname
          || ',1,5) = ''.THE ''';
       dbms_output.put_line (sqlst);
       execute immediate sqlst;
    end test;will update every row that satisfies the criteria in a single statement. If there are 10 rows that start with '.THE ' then it will update 10 rows.

  • Using Variables in a select statement through a Database Adapter

    I was wondering how I reference a variable in a select statement through a Database Adapter.
    Ex.
    1. I have a global variable that stores an employee number
    2. I want to select an SSN # from a table based on an employee #
    variable.
    select ssn from emp where ssn = :input_variable - ????
    - how do i reference the variable - I am getting a 'missing IN or OUT parameter error?
    Any advice is much appreciated.
    ~Thanks

    I'm just wondering if anyone knows a work around so that I might be able to store a Table's FIELD name in a variable or an array[] so that I can do a query based on the decision of a loop without having to code 10 IF/ELSE statements.For instance, although the above code will not work, this code, although quite lengthy, does:
    If DataGrid1.SelStartCol = 0 Then
    Adodc1.RecordSource = "Select * from tblReservation order by RES__PUR_DT"
    Adodc1.Refresh
    ElseIf DataGrid1.SelStartCol = 1 Then
    Adodc1.RecordSource = "Select * from tblReservation order by VENDOR"
    Adodc1.Refresh
    ElseIf DataGrid1.SelStartCol = 2 Then
    Adodc1.RecordSource = "Select * from tblReservation order by VEN_LOC"
    Adodc1.Refresh
    ElseIf DataGrid1.SelStartCol = 3 Then
    Adodc1.RecordSource = "Select * from tblReservation order by RES_TYPE"
    Adodc1.Refresh
    ElseIf DataGrid1.SelStartCol = 4 Then
    Adodc1.RecordSource = "Select * from tblReservation order by RES_FROM_DT"
    Adodc1.Refresh
    ElseIf DataGrid1.SelStartCol = 5 Then
    Adodc1.RecordSource = "Select * from tblReservation order by RES_TO_DT"
    Adodc1.Refresh
    ElseIf DataGrid1.SelStartCol = 6 Then
    Adodc1.RecordSource = "Select * from tblReservation order by MISC_ADJ"
    Adodc1.Refresh
    ElseIf DataGrid1.SelStartCol = 7 Then
    Adodc1.RecordSource = "Select * from tblReservation order by STATE_TAX"
    Adodc1.Refresh
    ElseIf DataGrid1.SelStartCol = 8 Then
    Adodc1.RecordSource = "Select * from tblReservation order by LOC_CHARGE"
    Adodc1.Refresh
    ElseIf DataGrid1.SelStartCol = 9 Then
    Adodc1.RecordSource = "Select * from tblReservation order by RES_ID"
    Adodc1.Refresh
    ElseIf DataGrid1.SelStartCol = 10 Then
    Adodc1.RecordSource = "Select * from tblReservation order by RES_OP"
    Adodc1.Refresh
    End If
    Do you see where i'm going with this?
    I simple want to use a variable in the "select * from <Table> Order by <Field>"

  • How to insert variable value using select statement - Oracle function

    Hi,
    I have a function which inserts record on basis of some condition
    INSERT INTO Case
    Case_ID,
    Case_Status,
    Closure_Code,
    Closure_Date
    SELECT newCaseID,
    caseStatus,
    Closure_Code,
    Closure_Date,
    FROM Case
    WHERE Case_ID = caseID
    Now i want new casestatus value in place of select statement caseStatus value. I have a variable m_caseStatus and i want to use the value of this variable in above select statement.
    how can i use this.
    thanks

    Hi,
    I have a function which inserts record on basis of some condition
    INSERT INTO Case
    Case_ID,
    Case_Status,
    Closure_Code,
    Closure_Date
    SELECT newCaseID,
    caseStatus,
    Closure_Code,
    Closure_Date,
    FROM Case
    WHERE Case_ID = caseID
    Now i want new casestatus value in place of select statement caseStatus value. I have a variable m_caseStatus and i want to use the value of this variable in above select statement.
    how can i use this. Do not select Case_Status from inner select, so null will be inserted then after inserting it update the case status with m_caseStatus.
    Regards.

  • How to enter bind variables in Calender SQL statement

    Hi,
    Anyone know how to include bind variables in Calender SQL statement. Let's say in sql statement below:
    select
    EMP.HIREDATE the_date,
    EMP.ENAME the_name,
    null the_name_link,
    null the_date_link,
    null the_target
    from SCOTT.EMP
    order by EMP.HIREDATE
    thanks.

    Hi,
    Here is the sql statement
    select
    EMP.HIREDATE the_date,
    EMP.ENAME the_name,
    null the_name_link,
    null the_date_link,
    null the_target
    from SCOTT.EMP
    where deptno = :dept
    order by EMP.HIREDATE
    Thanks,
    Sharmila

  • [php+mysql] how to use variables in a select statement?

    Hi all,
    I'm searching for a way to use a variable in the select
    statement of mysql
    query.
    I have this variable that can contain:
    $var=field_1 field_2 field5
    or
    $var=field3 field4 field8
    so, the variable content is not always the same.
    I would like to filter a table selecting only the columns
    specified by the
    current $var content.
    Is this possible to do something like this?
    $var=field1 field5 field10
    SELECT string_to_array($var)
    FROM mytable
    ORDER BY mysortfield ASC
    Or, is there another way to select columns dynamically?
    Thanks for any suggestion.
    tony

    Hi all,
    I'm searching for a way to use a variable in the select
    statement of mysql
    query.
    I have this variable that can contain:
    $var=field_1 field_2 field5
    or
    $var=field3 field4 field8
    so, the variable content is not always the same.
    I would like to filter a table selecting only the columns
    specified by the
    current $var content.
    Is this possible to do something like this?
    $var=field1 field5 field10
    SELECT string_to_array($var)
    FROM mytable
    ORDER BY mysortfield ASC
    Or, is there another way to select columns dynamically?
    Thanks for any suggestion.
    tony

  • Print out all methods in program with print statements

    Does anyone know how I would be able to print out all the methods in a program. For example:
    class bd220p1 {
         public static void main(String args[])  {
              int lightspeedi,lightspeedm;
              long days;
              long seconds;
              long distancei;
              long distancem;
              // approximate speed of light in miles per second
              lightspeedi = 186000;
                // approximate speed of light in Kilometers per second
              lightspeedm = 300000;
              days = 1000; // specify number of days here
              seconds = days * 24 * 60 * 60; // convert to seconds
              distancem = lightspeedm * seconds; // compute distance in English system
              distancei = lightspeedi * seconds;// compute distance in Metric system
              System.out.print("In " + days);
              System.out.print(" days light will travel about ");
              System.out.println(distancei + " miles and");
              System.out.print(distancem + " Kilometers ");
    }This code would produce 5 print statements for the 4 methods:
    1 Main method
    2 Print method
    3 Print method
    4 Println method
    5 Print method
    Does anyone know I can write the could to accomplish this? Right now I am experimenting with try/catch statements. Any help is greatly appreciated.

    It seems to me the easiest approaches (other than using a tool someone else has already written) are:
    1) Compile the source, and then use BCEL
    2) Try some regular expressions; it won't be perfect but maybe you can tweak it until it's good enough.
    3) Parse the source, and examine the parse tree.
    1 and 3 will give you much better results, but require you to use outside libraries (or write a parser yourself).
    You can do 2 using standard stuff from the JDK, but you may spend a lot of trial-and-error gettng the regexps right.
    Which you choose will depend a lot on what the prof giving the assignment allows.
    Also he may have some particular kind of solution in mind -- did he say anything?
    If you're not sure what to do, ask your prof for clarification.

  • Problem with print statements in procedure

    We have a stored procedure version that looks the same as this. My problem is that at the beginning of this routine, there's a print statement (right after the BEGIN keyword), and that prints out to the screen only if the print statement inside the loop is uncommented. Why is this? Does it have something with the buffer not flushing to the screen until it gets a certain amount of output. I tried copying that first statement over and over half a dozen times, but it didn't seem to help. I've tried
    set serveroutput on
    and
    set serveroutput on 2000
    and
    set serveroutput on 200000
    but no matter what, whether in this version or the procedure version, that first statement only prints if the second one is also in there!
    declare
    l_cnt integer;
    l_day_num integer;
    CURSOR CUR1 is
    select ACCTNUMBER,
    FNBR,
    REP
    FROM FSUMMARY;
    BEGIN
    DBMS_OUTPUT.put_line('Beginning daily_total and deleting CMHISTORYINDEXWORK');
    delete CMHISTORYINDEXWORK;
    commit;
    update FSUMMARY set FNBR='999999999' where FNBR is NULL;
    COMMIT;
    update FSUMMARY set REP='99' where REP is NULL;
    commit;
    FOR C in CUR1 LOOP
    select count(ACCOUNTNBR) into l_cnt from CMHISTORYINDEXWORK where FNBR=C.FNBR AND REP=C.REP AND ACCOUNTNBR=C.ACCTNUMBER;
    DBMS_OUTPUT.put_line('Count: ' || l_cnt || ' for rep ' || C.REP);

    The output from DBMS_OUTPUT is not displayed until the procedure completes, so your first call will not show until after all the work is done.
    Assuming that you actually have an END LOOP; and a final END; in the block, I see no reason why there would be any connection between the calls to DBMS_OUTPUT.
    Doing SET SERVEROUTPUT on SIZE just sets the maximum number of characters that can be stored in the outout buffer before it overflows. It has no bearing on whether or when anything gets printed. If the buffer is too small, you will get partial output and an error:
    ORA-20000: ORU-10027: buffer overflow, limit of 2000 bytes
    ORA-06512: at "SYS.DBMS_OUTPUT", line 35
    ORA-06512: at "SYS.DBMS_OUTPUT", line 198
    ORA-06512: at "SYS.DBMS_OUTPUT", line 139John

  • How to set DEBUG_FLAG = Y everytime form Print Statement ARXSUPST is opened

    Hi,
    Navigation: (R) AR Manager -> Print Documents -> Statements -> This opens Print Statement form.
    Goto Help -> Diagnostics -> Examine -> Block = SUPST_BLK, Field = DEBUG_FLAG; here the default value is N. I want to set the default value to Y
    Please let me know how to achieve this.
    Thank you.
    Manoj

    Hi,
    I could set DEBUG_FLAG to Y using Form Personalization follows:
    Trigger Event: WHEN-NEW-BLOCK-INSTANCE
    Context: my username
    Under Actions:
    Type: Property
    Object Type: Item
    Target Object: SUPST_BLK.DEBUG_FLAG
    Property Name: Value
    Value: Y
    Thanks
    Manoj

  • Trigger fails when variable used in WHERE statement

    I have a trigger that works when the following statment is in it:
    SELECT custcall.callrkey into v_callrkey from custcall where custcall.servno = 152345;
    But the trigger fails when I attempt to use a variable in the where statement as follows.
    SELECT custcall.callrkey into v_callrkey from custcall where custcall.servno = :new.servno ;
    Even though I have verified that the value of :new.servno is set to 152345 by outputting the value . That is the only difference between the working version and the non-working version. By not working I mean that the email which is to be sent by the trigger is not received.
    Can anyone give me any ideas of how I could troubleshoot this or what might me happening? I'm pretty new to this and
    feel that I'm missing something very simple. My apologies in advance if this has been posted elsewhere. I did spend a lot of time searching the forum before posting.
    This is Oracle 9i.
    Thanks!
    Full code probably not necessary but posted below just in case:
    create or replace
    TRIGGER EMAILNOTIFY_NEW_SR
    AFTER INSERT ON CUSTPROB
    FOR EACH ROW
    DECLARE
    --SMTP Variables
    vreply utl_smtp.reply;
    vreplies utl_smtp.replies;
    mailCONN utl_smtp.connection;
    mailHOST VARCHAR2(64) ;
    --MESSAGE Variables
    mailText VARCHAR2(64);
    mailFROM VARCHAR2(64);
    mailTO VARCHAR2(64);
    mailDATE VARCHAR2(20);
    v_servno number ;
    v_callrkey number ;
    --PROGRAM Variables
    i number;
    BEGIN
    --get some values from the database  
    --set values for variables...
    mailHOST:= '10.35.173.15'; --this will always stay the same 
    mailFROM := 'Facilities_Customer_Service_Center'; --this will always stay the same
    mailTO := '[email protected]';
    SELECT custcall.callrkey into v_callrkey from custcall where custcall.servno = :new.servno  ;
    SELECT TO_CHAR(SYSDATE,'MM/DD/YYYY HH24:MI:SS') INTO mailDATE FROM dual;
    dbms_output.put_line('open_connection');
    dbms_output.put_line('---------------');
    vreply := utl_smtp.open_connection(mailHOST, 25, mailCONN);
    dbms_output.put_line('helo');
    dbms_output.put_line('----');
    vreply := utl_smtp.helo(mailCONN, mailHOST);
    dbms_output.put_line( 'code = ' || vreply.code );
    dbms_output.put_line( 'text = ' || vreply.text );
    dbms_output.put_line('mail');
    dbms_output.put_line('----');
    vreply := utl_smtp.mail(mailCONN, mailFROM);
    dbms_output.put_line( 'code = ' || vreply.code );
    dbms_output.put_line( 'text = ' || vreply.text );
    dbms_output.put_line('rcpt to');
    dbms_output.put_line('----');
    vreply := utl_smtp.rcpt(mailCONN, mailTO);
    dbms_output.put_line( 'code = ' || vreply.code );
    dbms_output.put_line( 'text = ' || vreply.text );
    dbms_output.put_line('open_data');
    dbms_output.put_line('---------');
    vreply := utl_smtp.open_data(mailCONN);
    dbms_output.put_line( 'code = ' || vreply.code );
    dbms_output.put_line( 'text = ' || vreply.text );
    --SMTP ENVELOPE STUFF (In case it is needed later).  
    --utl_smtp.write_data(mailCONN, 'From:'  ||mailFROM     || chr(13));
    -- utl_smtp.write_data(mailCONN, 'To: '||mailTo || chr(13));
    --utl_smtp.write_data(mailCONN, 'CC:      '||mailFROM     || chr(13));
    --utl_smtp.write_data(mailCONN, 'Date:    '||mailDATE     || chr(13));
    --utl_smtp.write_data(mailCONN, 'BCC:     '||mailFROM     || chr(13));
    --THE MESSAGE
    utl_smtp.write_data(mailCONN, 'Subject: '||'Your Facilities Service Request ' ||'(SR '||v_servno||')'|| chr(13));
    utl_smtp.write_data(mailCONN, '');
    utl_smtp.write_data(mailCONN, '');
    utl_smtp.write_data(mailCONN, 'Dear Customer ' || chr(13));
    utl_smtp.write_data(mailCONN, '');
    utl_smtp.write_data(mailCONN, 'This is to inform you of something.' || ' ' ||mailTO|| chr(13) );
    utl_smtp.write_data(mailCONN, 'Please call us with any questions or concerns. ' || '' || chr(13));
    --DEBUG
    utl_smtp.write_data(mailCONN, 'DEBUG: ' || ''|| chr(13));
    utl_smtp.write_data(mailCONN, 'v_Servno ' || v_servno || chr(13));
    utl_smtp.write_data(mailCONN, 'v_callrkey ' || v_callrkey || chr(13));
    --END THE MESSAGE
    dbms_output.put_line('close_data');
    dbms_output.put_line('----------');
    vreply := utl_smtp.close_data(mailCONN);
    dbms_output.put_line( 'code = ' || vreply.code );
    dbms_output.put_line( 'text = ' || vreply.text );
    dbms_output.put_line('quit');
    dbms_output.put_line('----');
    vreply := utl_smtp.quit(mailCONN);
    dbms_output.put_line( 'code = ' || vreply.code );
    dbms_output.put_line( 'text = ' || vreply.text );
    END;

    Justin,
    Thanks for the reply. I'm away for a couple of days but when I get back to this I'm going to follow up on your suggestion about servno. I'm starting to think that the issue isn't with servno but rather that the select query doesn't return anything because the value I'm trying to get is in another table and is not being inserted in time for me to get them. This will be easiy enough to test. To be honest, I don't know very much about how things are being inserted.
    I appreciate your and Tubby's (and Tom's) concerns. Maybe I'll go back to the drawing board next week. But note that I'm not inserting anything with this trigger--only sending an email based on the insert that is happening through an application. So unless I'm really missing it, my email is dependent on the insert but not vice versa. Since my email is absolutely critical but rather jus a courtesy thing, I was taking a pretty laid back attitude about it but it would be good for me to learn a better way.
    Thanks again to all! I'll report back what I find/decide.

Maybe you are looking for

  • Home sharing

    hey guys, SOMEONE PLEASE HELP ME OUT HERE. okay so now i've set up home-sharing. Computer A can see B's library and Computer B can see A's library with the HOME ICON there. question is i have computer C. how can i allow computer C to see both A AND B

  • How do I find the original I tunes library that my Ipod is sycned too?

    We have been having problems with our computer and when we have got it back I have downloaded the latest version of Itunes. However when I put in my I pod to sync with it tells me that my ipod is already synced with another i tune library and it will

  • Why is my Macbook pro display text background yellow instead of white?

    Why is my Macbook pro display text background yellow instead of white? This problem is intermitten and when it occurs the yellow tint flickers.

  • How to use PROCESS_HU_INBOUND_DLVRY to pack HU to another HU

    Hi Experts! I was able to use PROCESS_HU_INBOUND_DLVRY to pack a material to an HU. I am now trying to pack the HU created earlier to another HU. Anybody who has tried it? What parameters should I pass to the FM? Am I passing the correct ones? i_save

  • Grid snapping in xy graph

    hi  i want to snap the grid in xy graph i am plotting graph using mouse down event now i want to snap grid on mouse down(means if i click any where the point will be entered on nearest grid) regards mazhar Solved! Go to Solution.