How to execute the value of variable

Hi All
I am using oracle 10 g
DECLARE
sql_stmt VARCHAR2(200);
BEGIN
sql_stmt := 'select * from tab';
EXECUTE IMMEDIATE sql_stmt;
END;
I have try to run the above code , but it is not working in oracle,
which is working good in MS sql server
and how to return result in dataset ?
ok Bye
Message was edited by:
user641352

All PLSQL code must be known at compile time so executing a Forms built-in that is formed at runtime is not possible.

Similar Messages

  • How to pass the value of variable to another java file?

    Hi. I have 2 java files (LogonAction.java and PCAction.java). The value of variable(String getrole) depends on the logon user. How can I use this value of variable in PCAction.java? I want to execute a sql statement in PCAction.java which is (String sql="Select * from PP where role"+"='" + getrole + "'") Thanks a lot.
    LogonAction.java is below:
    package test;
    import test.jdbc.util.ConnectionPool;
    import java.sql.*
    import java.util.*;
    import javax.servlet.http.*;
    import org.apache.commons.logging.*;
    import org.apache.struts.action.*;
    import org.apache.struts.util.*;
    import org.apache.commons.beanutils.PropertyUtils;
    public final class LogonAction extends Action {
    private Log log = LogFactory.getLog("org.apache.struts.webapp.Example");
    private ConnectionPool pool;
    public LogonAction() {
    pool = ConnectionPool.getInstance();
    public String getrole;
    public ActionForward execute(ActionMapping mapping,
    ActionForm form,
    HttpServletRequest request,
    HttpServletResponse response)
    throws Exception {
    Locale locale = getLocale(request);
    MessageResources messages = getResources(request);
    ActionErrors errors = new ActionErrors();
    String username = (String)PropertyUtils.getSimpleProperty(form, "username");
    String password = (String)PropertyUtils.getSimpleProperty(form, "password");
    String getusername=CheckUser(username,password);
    getrole=getusername;
    java.lang.System.out.println(getrole);
    if ("".equals(getusername))
    errors.add(ActionErrors.GLOBAL_ERROR,
    new ActionError("error.password.mismatch"));
    getusername=username+getusername;
    // Report any errors we have discovered back to the original form
    if (!errors.isEmpty()) {
    saveErrors(request, errors);
    return (mapping.getInputForward());
    // Save our logged-in user in the session
    HttpSession session = request.getSession();
    session.setAttribute(Constants.USER_KEY, getusername);
    if (log.isDebugEnabled()) {
    log.debug("LogonAction: User '" + username +
    "' logged on in session " + session.getId());
    // Remove the obsolete form bean
    if (mapping.getAttribute() != null) {
    if ("request".equals(mapping.getScope()))
    request.removeAttribute(mapping.getAttribute());
    else
    session.removeAttribute(mapping.getAttribute());
    // Forward control to the specified success URI
    return (mapping.findForward("success"));
    * Look up the user, throwing an exception to simulate business logic
    * rule exceptions.
    * @param database Database in which to look up the user
    * @param username Username specified on the logon form
    * @exception ModuleException if a business logic rule is violated
    public String CheckUser(String username,String password){
    Connection con = null;
    try
    con = pool.getConnection();
    String sql = "SELECT * from user WHERE userid = ? AND password= ?";
    PreparedStatement ps = null;
    ResultSet rs = null;
    try {
    if (con.isClosed()) {
    throw new IllegalStateException("error.con.isClosed");
    ps = con.prepareStatement(sql);
    ps.setString(1,username);
    ps.setString(2,password);
    rs = ps.executeQuery();
    String returnstr="";
    while(rs.next())
    returnstr=rs.getString("role");
    java.lang.System.out.println(returnstr);
    return returnstr;
    } catch (SQLException e) {
    e.printStackTrace();
    throw new RuntimeException("error.ps.executeQuery");
    } finally {
    try {
    if (ps != null)
    ps.close();
    if (rs != null)
    rs.close();
    } catch (SQLException e) {
    e.printStackTrace();
    throw new RuntimeException("error.rs.close");
    catch (SQLException e)
    e.printStackTrace();
    throw new RuntimeException("Unable to get connection.");
    finally
    try
    if (con != null)
    con.close();
    catch (SQLException e)
    throw new RuntimeException(e.getMessage());
    }

    You can use PreparedStatement and
    String cmd = "select * from PP where role=?";
    PreparedStatement stmt = conn.prepareStatement(cmd);
    stmt.setString(1,theRole);

  • How to change the value of variable in .bpel file

    Hi,
    How can i change the value of variable in .bpel file at time of deployment.
    Can it be possible with configplan.xml or deployment descriptor?
    Thanks
    Richa

    You cannot change the value of variable in .bpel file using config plan. If you want to change value at runtime , you can use Preference variable. Below is the blog to help you understand more.
    http://eelzinga.wordpress.com/2009/10/28/oracle-soa-suite-11g-setting-and-getting-preferences/
    Cheers,
    Durga
    Please remember to mark appropriate posts as correct/helpful. For the long run, it will benefit us all.

  • How to store the value to variable?

    hi
    plz c the below code...
    my prblm is i want to store the value of wa_final-preis into new_xeipa-preis if there is only one ebeln...
    if there are more procss orders then i want to save the first value to new_xeipa-preis wn second record comes then new_xeipa-preis should be replaced by new value and old_xeipa-preis replaced by old value....
    how to do this?
    LOOP AT xeipa INTO wa_xeipa.
      idx = sy-tabix.
      CLEAR: wa_xeina.
        READ TABLE xeina INTO wa_xeina WITH KEY infnr = wa_xeipa-infnr.
        IF sy-subrc is INITIAL.
        wa_final-infnr = wa_xeipa-infnr.
        wa_final-ebeln = wa_xeipa-ebeln.
        wa_final-bedat = wa_xeipa-bedat.
        wa_final-matnr = wa_xeina-matnr.
        wa_final-lifnr = wa_xeina-lifnr.
        wa_final-peinh = wa_xeipa-peinh.
        wa_final-preis = wa_xeipa-preis.        "net price
        wa_final-bprme = wa_xeipa-bprme.
        wa_final-bwaer = wa_xeipa-bwaer.
        IF ( wa_final-infnr is NOT INITIAL ) AND ( wa_final-ebeln is NOT INITIAL ) .
        ABWEICHUNG = ( new_xeipa-preis / old_xeipa-preis ) * 100 .
        ENDIF.
        append wa_final to it_final.
        ENDIF.

    Hi Smitha,
    Check the below given code.
    LOOP AT xeipa INTO wa_xeipa.
      idx = sy-tabix.
      CLEAR: wa_xeina.
        READ TABLE xeina INTO wa_xeina WITH KEY infnr = wa_xeipa-infnr.
        IF sy-subrc is INITIAL.
        wa_final-infnr = wa_xeipa-infnr.
        wa_final-ebeln = wa_xeipa-ebeln.
        wa_final-bedat = wa_xeipa-bedat.
        wa_final-matnr = wa_xeina-matnr.
        wa_final-lifnr = wa_xeina-lifnr.
        wa_final-peinh = wa_xeipa-peinh.
        wa_final-preis = wa_xeipa-preis.        "net price
        wa_final-bprme = wa_xeipa-bprme.
        wa_final-bwaer = wa_xeipa-bwaer.
    " First time this value is not populated. When the second value comes in,
    " New value gets populated in OLD variable and New value is replaced with the latest.
        *IF idx NE 1.*
          *old_xeipa-preis = new_xeipa-preis.*
        *ENDIF.*
        *new_xeipa-preis = wa_xeipa-preis.*
      IF ( wa_final-infnr is NOT INITIAL ) AND ( wa_final-ebeln is NOT INITIAL ) .
        ABWEICHUNG = ( new_xeipa-preis / old_xeipa-preis ) * 100 .
        ENDIF.
        append wa_final to it_final.
        ENDIF.
    ENDLOOP.
    I hope this is what you were looking for.
    Thanks & Regards,
    Ram.
    Edited by: ram Kumar on Jun 12, 2009 5:16 PM

  • How to replace the values in variable selection Screen urgent plz

    Hi all,
    I am having a requirement. where the user need pass the value in the variable, Here v r having option like '1' and '2' which represent 'month' and 'ytd'.
    While selecting user view as 1,2 .Now my requirement is to replace the value 1=monthly and 2=ytd while the user passing the value to avoid the confusion.
    Is it possible if so plz let me know
    Regards

    Dear Venkat.
    You please try the following steps:
    1. Say the InfoObject is 0EMPLOYEE against which you have created the variable, which user is trying to select value against, when they execute the report.
    2. Goto RSA1-> InfoObject tab-> Select InfoObject 0EMPLOYEE.
    3. Selcet the following options:
       Query Execution Filter Val. Selectn  -  'Only Posted Value for Navigation'
       Filter Value Repr. At Query Exec. -      'Selector Box Without Values'
    Please let me know if there is any more issue. Feel free to raise further concern
    Thnx,
    Sukdev K

  • How to store the value into variable and access it in RMAN script

    I want to create a variable and dynamically assign a numeric value to it (may get the value may be from SQL )and access the value in RMAN script.
    Thanks...Raj

    Raj,
    We have been getting this type of request and it is not possible via RMAN to do that.
    BUT--You could write a sql/plus script to query your variable and produce the RMAN script with the new value.
    Just a suggestion.
    Tammy

  • How to clear the value of variable declared with STATICS keyword in FM?

    Hi All,
    I am using a standard CRM FM:CRM_CLA_RES_UPDATE_FM in that a STATICS variable is declared. In my code this STATICS varible value is populating. Iam to clear that Varible.
    How to do that.
    Thanks and Regards,
    Shabeer Ahmed,

    If you have 6.0 or up version then you will have a spiral button for your ABAP editor in you application toolbar. this is to find enhancements provided to you for standard programs. if you click on this you will get the enhancement points which you can identify and use accordingly to change/edit your STATICS variable content.
    if not, then you'll probably have to write to OSS , if you can open the code and do the required correction.

  • How to disply the value of variable in the Web template

    Imagine I have a query TOP-N customers. I want to diplay N value in the web template. I used web item for this purpose in NW2004. Which item should I use for the same purpose in NW2004s?
    Thanks

    Does anyone have another suggestion? The information field does not render pretty. I am trying to do this via an HTML path edit and a text box. The view source looks like this for a variable
    <BICS_VIEW>
      <VARIABLES>
        <VARIABLE name="RDSHW_PCY_YOVERY" type="DOUBLE" text="% Goal Year over Year" value="10.0"/>
      </VARIABLES>
    I tried various versions of the path=... but cannot get it to work. Anyone got an idea ???
    I tried
    path="DATA_PROVIDER:DP_1?/BICS_VIEW/VARIABLES/VARIABLE/@value" />

  • How to find the value of a variable in other program

    How to find the value of a variable in other program say I am in a FM and this FM is being called in from other program and I want to know some of the variable details of the program from the FM itself. Imagine if this is a txn. and I need to know the details from some of the programs while executing the same transaction
    Regards
    Vin

    Hi Vinayak,
         you will be having your first program values in internal table or some variables,
        when you are calling the second program you wii use like this,
        SUBMIT <Second Program Name> USING SELECTION-SCREEN '1000'
                           WITH s_emp(second program select-options)   IN t_emp(first program variables)
                           WITH p_chk   EQ t_chk
                           WITH p_r1    EQ t_r1
                           WITH p_month EQ t_month
                           WITH s_cust1 IN t_cust1
                           WITH p_r2    EQ t_r2
                           WITH s_cust2 IN t_cust2
                           WITH s_week  IN t_week
                           AND RETURN.
    you have pas like this to get your first program details.

  • How to get the value of a variable defined in javascript in JSP

    how to get the value of a variable defined in javascript in/through JSP????

    In Javascript you can use the DOM to access the input element and set it's value before submitting the form. Then it's value will just be passed.

  • How to get the value of a variable in FOX?

    Hi,
    In the FOX program how to get the value of a variable defined in planning area?
    can anyone give me some sample code?
    thanks

    Adding to the last reply,
    you can use VARI(variable) to get the count of the values.
    In the latest version of BPS, you may also use the following new foreach construct:
    FOREACH var IN VARIABLE  variable_id.
    Regards - Ravi

  • How to execute the content of varchar  variable like a simple query

    Hi everyone!
    I did a PL/SQL region in apex, in this region I did the query which is storaged in a variable; it was did it concatenate several times,
    in the procedure I have several sentences.
    I thought that the command 'execute immediate' would get a good result but it do not print the result.
    declare
    variable varchar2(1000);
    begin
    --sentences
    --execute inmmediate( variable );
    --return variable
    end;
    I only want to how to execute the content of varchar variable.
    For example, suppose that the result of this procedure is
    'SELECT SYSDATE FROM DUAL'
    How and what do I must do for this query execute like a normal query that is in apex?
    I expect your prompt reply.
    Thank you for your help.
    Best regards

    Let us say your table containing SQL is
    t_sql_table
    and has two columns
    primary_key
    and
    sql_query.
    You would need to do the following:
    1. Create a Report of type "Function returning SQL Query"
    2. Put the following there:
    DECLARE
       v_query   VARCHAR2 (4000);
    BEGIN
       SELECT sql_query
         INTO v_query
         FROM t_sql_table
        WHERE primary_key = 1;
       RETURN v_query;
    END;Denes Kubicek
    http://deneskubicek.blogspot.com/
    http://www.opal-consulting.de/training
    http://apex.oracle.com/pls/otn/f?p=31517:1
    -------------------------------------------------------------------

  • How to use the value of a variable to set another variable

    Hello Experts,
    Is it possible to access the value of variable set by the user and set the default value of another variable using the user entered value for the first variable? Example:
    Date variable
    Week variable
    Month variable
    User enters one of those and the other two are automatically prefilled with the correct values?
    Thanks
    Rado

    Hi Rado,
    Gothrough following code
    Which reads year from user input and converts it to factory calendar week , following which you should able to convert user inputs to required parameters.
    DATA:  v_year1 TYPE i,
            v_int   TYPE i,
            v_week1 TYPE kweek,
            v_qurt  TYPE i,
            v_perd  TYPE /bi0/oifiscper,
            v_iweek TYPE i,
            v_periv TYPE periv VALUE 'Z4'.
    DATA : v_vweeks  TYPE /bi0/oicalweek,
            v_vperd   TYPE /bi0/oifiscper,
            v_vperiv  TYPE /bi0/oifiscvarnt VALUE 'Z4'.
    DATA : vit_weeks LIKE /bi0/scalweek OCCURS 0 WITH HEADER LINE.
    DATA : v_perd1   TYPE umc_y_fiscper,
            v_weeks   TYPE umc_ys_dimvals,
            v_pweeks  TYPE i.
    CASE i_vnam.
       WHEN 'WPIYWEEK'.                "Variable name of char. in Bex
    *Check for Step 2 (After user gives inputs on selection screen)
         CHECK i_step = c_after.                                "Step:2
         CLEAR :  v_year1,
                  v_week1,
                  v_iweek.
    *Read the value of variable which used has entered on sel. screen
         READ TABLE i_t_var_range INTO wa_var_range
                                     WITH KEY vnam = 'WPIFYEAR'.
         v_year1 = wa_var_range-low.
         CALL FUNCTION 'TIME_GET_LAST_WEEK'
           EXPORTING
             if_year     = v_year1
           IMPORTING
             ef_week     = v_week1
           EXCEPTIONS
             fatal_error = 1
             OTHERS      = 2.
         IF sy-subrc <> 0.
    *           MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *           WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
         ENDIF.
    *Get the no. of week from YYYYWW format
         v_iweek = v_week1+4(2).
         l_s_range-low  = v_iweek.
         l_s_range-sign = c_include.
         l_s_range-opt  = c_equal.
         APPEND l_s_range TO e_t_range.  "This is the output structure in which u have to add the result
    Endcase.
    Hope that helps.
    Regards
    Mr Kapadia
    Assigning points is the way to say thanks in SDN.

  • How to set the value of process variables/payload using a managed bean?

    Hello,
    Someone can give me an example about how to set the values of a process payload in a managed bean?
    thank you!

    Try this:
    jsf page:
    <af:selectOneChoice label="Select Suburb"
    requiredMessageDetail="Select a suburb"
    valueChangeListener="#{selectOneChoiceBean.onValueChanged}"
    validator="#{selectOneChoiceBean.validate}"
    unselectedLabel="None" autoSubmit="true"
    binding="#{selectOneChoiceBean.selectOneChoice}"
    value="#{selectOneChoiceBean.value}">
    <f:selectItems value="#{selectOneChoiceBean.selectionList}"/>
    </af:selectOneChoice>
    backing bean:
    public class SelectChoiceBean {
    private List<SelectItem> selectionList;
    private String value = "B";
    private RichSelectOneChoice selectOneChoice;
    public SelectChoiceBean() {
    initSelectionList();
    public void setSelectionList(List<SelectItem> selectionList) {
    this.selectionList = selectionList;
    public List<SelectItem> getSelectionList() {
    return selectionList;
    public void onValueChanged(ValueChangeEvent valueChangeEvent) {
    System.out.println(valueChangeEvent.getNewValue());
    // Add event code here...
    public void validate(FacesContext facesContext, UIComponent uIComponent,
    Object object) {
    // Add event code here...
    private void initSelectionList() {
    selectionList = new ArrayList<SelectItem>();
    selectionList.add(new SelectItem("A", "A label"));
    selectionList.add(new SelectItem("B", "B label"));
    selectionList.add(new SelectItem("C", "C label"));
    public void setValue(String value) {
    this.value = value;
    public String getValue() {
    return value;
    public void setSelectOneChoice(RichSelectOneChoice selectOneChoice) {
    this.selectOneChoice = selectOneChoice;
    public RichSelectOneChoice getSelectOneChoice() {
    return selectOneChoice;
    }

  • How to Execute the row by row sql syntax

    Hello,
    when I execute the below I get the result as attached, how to execute the syntax in each row, Thanks for your help!
    select 'select * into TestSSRS.'+ Table_Name + ' from AdventureWorksDW2008R2.'+ Table_Name FROM [dbo].[Tables_To_Copy]

    Maybe you could store the value of that field in a string variable using a cursor, i expect you dont need to execute this query very often, because using cursor is not always the best option in data sets.
    Regards!
    Sergio Sánchez Arias
    Oaxaca,México
    AYÚDANOS A AYUDARTE

Maybe you are looking for

  • How to restore backed up information from desktop file

    I had my computer worked on and the tech had to back up all my information and he stored it in a file and put it on my desktop. I now would like to reinstall all the pics, and other information. How do I do that?

  • The launch feature of Creative Media Source 5.

    I need to clarify my question. I was able to install components of the latest version of Creative Media Source 5 from the WEB. All but the Go! feature seem to work OK!? Am I missing something or am I doing something wrong? I hilight that section in t

  • Using Dictinary types of a Model in the added DC

    Hi all, I have created a new development component. In this DC I have added another DC as used DC in order to use its public web dynpro component. This added DC belongs to another software component. That is this DC belongs to another package as my D

  • Infopath 2010 - Can't turn off Underline on a textbox

    I have added and re-added a textbox to a form trying to fix this, but can't get it working.  If I select the textbox then click the Underline icon, it turns off...then turns right back on.  I have other textboxes that work fine, but I can't find anyt

  • How to recovery notes that was saved in the iTunes after you change your iPad´s name ?

    Hey guys, good day I bougth the iPad 2 and had the backup with different name for my iPad 1 and now when I started this new one, my previous notes and email configuration was not saved... Do you know how can I pick up my old notes in the iTunes ? I t