How to get the value of a string

I have a problem where I am suppose to determine the value of a

variable.

However at the time of the design, I don't know the name of the variable.

During execution, the name of the variable will be given and based on the

given the name of the variable, I need to find the value of the specified

the name of the variable.

DECLARE

NOM_DE_VARIABLE VARCHAR2 (1000);

VARIABLE1 VARCHAR2 (1000): = 1;

VARIABLE2 VARIABLE2 (1000): = 2;

BEGIN

NOM_DE_VARIABLE: = 'VARIABLE1 ';

END;

In the example above of the VARIABLE_NAME value is 'VARIABLE1 '.

That's why I need to return a value of '1'.

And if the VARIABLE_NAME is 'VARIABLE2', then the return value

would be '2'.

I know that this can be done using simple if else, however if the number of

Variables is unknown or very large.

So if on the other would not.

Please advise, thank you

The instinctive reactions are WTF!

This is NOT how a codes in ALL languages - address variables directly and dynamically.

But in PL/SQL, horribly enough, can be done using associative arrays.

SQL > declare
2 type TVariableContainer is table of indexes varchar2 (4000) by varchar2 (30);
3
var 4 TVariableContainer;
5 varName varchar2 (30);
6 start
7 put variables into the container
8 ('variable1') var: = 1;
9 ('variable2') var: = 2;
10
11 set the name of a variable
12 - a variable in the container
13 varName: = 'variable1 ';
14 dbms_output.put_line ('varName "variable1" variable value");
15
16. now solve this problem by assigning the
17 - value of container that him
18 varName: = var (varName);
19 dbms_output.put_line (' varName is value ['| varName |']) ' );
20
21 - repeat
22 varName: = 'variable2;
23 dbms_output.put_line ('varName variable 'variable2' value');


24 varName: = var (varName);
25 dbms_output.put_line (' varName is value ['| varName |']) ' );
26 end;
27.
varName variable value "variable1".
varName is value [1]
varName variable value "variable2.
varName is value [2]

PL/SQL procedure successfully completed.

SQL >

Tags: Database

Similar Questions

  • How to get the value of a variant as a string

    I have an existing codebase, which transmits the values of the user interface to business logic as variants. I was prompted to connect all values passed in this way in a text file. I'm trying to figure out how to get the data as a string to a Variant value without having to deal on the type for the data descriptor. The flag variant the fact, so I think I can, too.

    Anyone know how?

    Thank you, all! I decided to use the XML approach:

  • How to get the value of the TextField on Buton FieldChangeListener

    friends I am new on the development of blackberry applications could you please help me how to get the value of text I typed in the textField when I click the button?

    constructor

    public Dialogs()
    {
      
    using design in the same screen
      
    Display display = new MainScreen();
      
    ButtonField btnPress = new ButtonField();
    btnPress.setLabel ("press me");
    btnPress.setChangeListener (ButtonPressListener);
      
    TxtValue TextField = new TextField();
    txtvalue.setLabel ("enter something :");
      
    HFM VerticalFieldManager = new VerticalFieldManager (VerticalFieldManager.FIELD_VCENTER);
    HFM. Add (txtValue);
    HFM. Add (btnPress);
      
    mainScreen.add (hfm);
    pushScreen (mainScreen);
      
      
    }

    FieldChangeListener ButtonPressListener = new FieldChangeListener() {}
    ' Public Sub fieldChanged (field field, int context) {}
        
           
    Dialog.Alert (t.GetText ());
         
         
         
    }
    };

    any help would be appreciated.

    You must ensure that your FieldChangeListener has access to the object of txtvalue, while it can make a

    String inputString = txtvalue.getText ();

  • How to get the value of the outputtext in javascript and send it to backing bean

    Hi Experts ADF,

    JDev Version 11.1.1.7.0

    I have the following: the value of the outputtext must be treated in javascript and the serverlistener method has the same value. I founded this value returns a string that wshould see the mouseover NIJ.

    Help, please. Thanks in advance.

    < af:column sortProperty = "#{bindings." OrderProposalReadClient.hints.exceptions.name}.

    filterable = "true" sortable = "true".

    headerText = "#{suiviewBundle.EXCEPTIONS} '"

    ID = "c16" >

    < af:outputText value = "#{row.exceptions}" id = "ot32" clientComponent = "true" > "

    < af:clientListener type = "mouseOver".

    method = "customJsFunction" / >

    < af:serverListener type = "mycustomserverEvent".

    Method="#{pageFlowScope.ChangeOrderProposalBean.handleServerEvent}"/ >

    < / af:outputText >

    < / af:column >

    JavaScript

    < af:resource type = "javascript" >

    var customJsFunction = function (event)

    {

    var exceptiondata = AdfPage.PAGE.findComponentByAbsoluteId ('ot32');

    AdfCustomEvent.queue ();

    Returns true;

    }

    < / af:resource >

    BackingBean

    public String handleServerEvent(EC ClientEvent)

    {

    Please let me know how to get the value that javascript code sends here.

    Let's say javascript sends the value of outputtext as "001".

    So, I have to check "001" in my list and return a value that appears on mouseover.

    }

    Kind regards
    Roy

    Hello, Roy.

    To use the value on another component of the user interface, I shows an example:

    -code of the page

    shortDesc = "shortDesc" >

    method = "customJsFunction" / >


    -the javascript code

    var customJsFunction = function (event)

    {

    var exceptiondata = event.getSource ().findComponent("ot32").getValue ();

    AdfCustomEvent.queue (event.getSource (),

    "mycustomserverEvent,"

    {param1:exceptiondata},

    (true);

    Returns true;

    }

    -OutputTextCase11.java

    public void handleServerEvent (EC ClientEvent)

    {

    String param = (String) ce.getParameters () .get ("param1");

    RichOutputText outputText = (RichOutputText) ce.getComponent () .findComponent ("ot1");

    outputText.setShortDesc (param);

    outputText.setValue (param);

    AdfFacesContext.getCurrentInstance () .addPartialTarget (outputText);

    }

    I hope this helps you.

    RFH.

  • How to get the value of viewrow by chain

    With the help of Jdev11.1.1.5.0 - adfbc - ireport3.0.0

    Here I will describe: what I've done.

    use jsff (dynamic region) while hitting the af:tree nodes it opens. Fine OK

    I had somevo manually wroten Query. and the query is fine no problem with it
     here i give sample not a original query
    select * from sometable where acctid = :pacctid
    I do drag and drop the pacctid correspondent run params vo as selectoncechoice


    public static vo
    Value of data - to pay account, advance

    Announcement name - ap, given


    in this jsff
    *page representation*
    
    account type :   account payable (ap) - select one choice type
                            advance           (ad) - select one choice type
    
    like this some select once choice and some inputs.
    
    Run report - command button
     .jsff code 
    <af:selectOneChoice value="#{bindings.ACCT_TYPE.inputValue}"
                              label="Account Type"
                              shortDesc="#{bindings.ACCT_TYPE.hints.tooltip}"
                              id="soc3" required="true" 
                              autoSubmit="true"
                              binding="#{backingBeanScope.SUP1040V.soc3}"
                              valuePassThru="true"
                              valueChangeListener="#{backingBeanScope.SUP1040V.ValueChangeListener1}">
                             
            <f:selectItems value="#{bindings.ACCT_TYPE.items}" id="si3"/>
          </af:selectOneChoice>
    
     <af:commandToolbarButton text="Export in pdf" id="ctb2">
              <af:fileDownloadActionListener method="#{backingBeanScope.SUP1040V.Report}"
                                             />
            </af:commandToolbarButton>
    . Java
         //while hitting the button following logs are appeared i show it as commented format.
    
        public void Report(FacesContext context, OutputStream out) throws IOException,Exception
            {
            
                FacesContext ctx = FacesContext.getCurrentInstance();
                HttpServletRequest request =
                    (HttpServletRequest)ctx.getExternalContext().getRequest();
                HttpServletResponse response =  
                    (HttpServletResponse)ctx.getExternalContext().getResponse();
                
            .....
                         
                BindingContainer bindings1 = BindingContext.getCurrent().getCurrentBindingsEntry();
                System.out.println("print binding" +bindings1 );
           
    //while using sop i get this in my log : :  print binding  ReportsPageFragments_SUP1040VPageDef_WEB_INF_TaskFlows_SUP1040_V_TF_xml_SUP1040_V_TF
    
           
                JUCtrlListBinding listBinding1 = (JUCtrlListBinding)bindings1.get("ACCT_TYPE");
                System.out.println("print list bindings" +listBinding1 );
           
    //while using sop i get this in my log : :  print list  bindings0
    
    
                Object selectedValue1 = listBinding1.getSelectedValue();
                System.out.println("print selected value" + selectedValue1);
    
    //while using sop i get this in my log : :  print selected  valueViewRow [oracle.jbo.Key[AP ]]    
                
                  
     request.setAttribute("ACCT_TYPE", //here i want the value  "AP" in  String  ); 
    
    if i use like this means
    request.setAttribute("ACCT_TYPE", soc1.getValue()  );  i get the index value.
    
    i need the dataname "ap" so i go above method which say wrotes ...
                 
              
                           ...                                    
                request.getRequestDispatcher(response.encodeURL("/sup1040servlet")).forward(request,response);
                
                System.out.println("hihihihih");
                response.flushBuffer();
                ctx.responseComplete();
           
            }
    
        public void ValueChangeListener1(ValueChangeEvent valueChangeEvent) {
            // Add event code here...
            String AcctType = valueChangeEvent.getNewValue().toString();
            System.out.println("AcctType" + AcctType);
            FacesContext contxt = FacesContext.getCurrentInstance();
            valueChangeEvent.getComponent().processUpdates(contxt); 
          
           BindingContainer bindings1 =
           BindingContext.getCurrent().getCurrentBindingsEntry();
           // Get the sepecific list binding
           JUCtrlListBinding listBinding1 =
           (JUCtrlListBinding)bindings1.get("ACCT_TYPE");
           // Get the value which is currently selected
           Object selectedValue1 = listBinding1.getSelectedValue();
           System.out.println(selectedValue1);
        }
    If I get ap means my report runs. or otherwise it will show an empty page.

    How to get the value of class viewrowimpl as string.

    Published by: ADF7 on March 24, 2012 07:27

    ADF7,
    I'm not sure that understand what you're up to.
    For as far as I understand you want to get the value of display rather than the index
    I use this code

        public void StatusChangedListener(ValueChangeEvent valueChangeEvent)
        {
            BindingContext lBindingContext = BindingContext.getCurrent();
            BindingContainer lBindingContainer = lBindingContext.getCurrentBindingsEntry();
            JUCtrlListBinding list = (JUCtrlListBinding) lBindingContainer.get("Status");
            int newindex = (Integer) valueChangeEvent.getNewValue();
            Object row = list.getDisplayData(); // Wichtig um die liste zu laden!!!!
            Row lFromList = (Row) list.getValueFromList(newindex);
            Object lAttribute = lFromList.getAttribute("Value");
            String newVal = (String) lAttribute;
        }
    

    to get the value of a component of selectOneChoice...

    Timo

  • How to get the value of the VO to the lov controller?

    Hello

    Can I know how to get the values of the View object, then pass in lov controller to execute the query... pls help...

    I tried the below:

    ' Public Sub processRequest (pageContext OAPageContext, OAWebBean webBean)
    {
    super.processRequest (pageContext, webBean);

    OAViewObject vo = (OAViewObject) am.findViewObject ("SeaoeAutoMosSummaryVO1");
    String s_it = (String) vo.getCurrentRow () .getAttribute ("ItemType"); / / If I enable this line, it will return the nullpointerexception error
    OAViewObject itemVO = (OAViewObject) am.findViewObject ("SeaoeAutoMosFIVO1");

    If ("lovValidate". Equals (PageContext.GetParameter (EVENT_PARAM)))
    {
    itemVO.setWhereClause (null);
    System.out.println ("b4 execute111");
    itemVO.setWhereClauseParams (null);
    itemVO.setWhereClauseParam(0,"F");
    itemVO.setWhereClauseParam(1,"OHO");
    itemVO.executeQuery ();
    }

    }

    yuchijoyce wrote:
    Jin

    I wanto add new line, the lov CO will have the value 2 in the base page move to filter the lov...
    the problem, I do face is: failed to get the vo value (new line) in lov CO.

    Try setting the PPR action with this field which will set the value in the session then get session value in the controller of the LOV and put the Original where clause.

    Thank you
    AJ

  • XML: How to get the value of the node when the node of pasing as a parameter name

    Hello

    I've got some xml:

    var xmlData:XML = 
    <1stNode>
        <buttonID>first child node value</buttonID>
        <imageID>second child node value</imageID>
        <labelID>third child node value</labelID>
    </1stNode>
    

    So, I want to read the value of specific node based on a value passed to a function. .

    var buttonID = new Button;
    
    var imageID = new Image;
    
    var labelID = new Label;
    
    
    getNodeValue(buttonID); //the value here is set dynamically
    
    private function getNodeValue (nodeName:String):void {
    
    trace (xmlData.nodeName)                      //doesn't work
    
    var str:String = "xmlData." + nodeName;
    var xml:XMLList = str as XMLList             //doesn't work
    
    }
    

    I don't know how to get the value when the name of the node is changed dynamically.

    use:

    getNodeValue(buttonID); //the value here is set dynamically
    
    private function getNodeValue (nodeName:String):void {
    trace (xmlData[nodeName])
    }
    
    
  • How to get the value of a selected character unicode?

    Hi all

    How to get the value of a selected character unicode?

    The content property of a 'Character' InDesign object is a simple Unicode string. For access to the various characters is a basic javascript operation, and a google gives this as a good first result: http://www.w3schools.com/jsref/jsref_charCodeAt.asp

    Therefore, the value of a selected character unicode is

    App.Selection [0]. Characters [0].contents.charCodeAt (0)

  • How to get the value of viewattribute and how to assign the text field. URG

    Hi all,
    I created messagestyled text programmatically and I want the value of viewAttribute.
    I don't know how to define the instance of the view and display attribute.

    I tried this way, it is what is called the vo class but after that i dnt know how to set

    Here the code that I used...

    (1) I create the messagestyled text
    OAFormattedTextBean cctextbean = (OAFormattedTextBean) pageContext.getWebBeanFactory () .createWebBean (pageContext, FORMATTED_TEXT_BEAN, OAWebBeanConstants.VARCHAR2_DATATYPE, "CCText");

    OAMessageStyledTextBean ccidbean = (OAMessageStyledTextBean) pageContext.getWebBeanFactory () .createWebBean (pageContext, MESSAGE_STYLED_TEXT_BEAN, OAWebBeanConstants.VARCHAR2_DATATYPE, "CCId");

    (2) and I called the view object
    OAViewObject ccview = (OAViewObject) AM.findViewObject ("CmpnyDetVO1");

    (3) I want to set the view instance and viewattribute using code. This stage i dnt know how to define.

    (4) I want to know, how to get the value of the attribute to display and how to set the value to the messagestyled text field.

    I'm new to OFA. It's Urgent.

    Thanks in advance
    Fabrice

    Hello

    use
    Import oracle.jbo.Row;

    OAViewObject ccview = (OAViewObject) AM.findViewObject ("CmpnyDetVO1");
    Line line (Row) = ccview.first ();
    Test String = (String) row.getAttribute ("");

    then to set the value of the text of messagestyled

    OAMessageStyledTextBean bean = (OAMessageStyledTextBean) webBean.findindexedchildrecursive ("CCId");
    bean.setText (test);

    Thank you
    Gerard

    Published by: Gauravv on August 4, 2009 09:38

  • How to get the value of an editField on onUnfocus()

    I want to check the value of an editfield on focusout/focusouthandler(), how to get the value in the onUnfocus() method?

    getText

  • How to get the value of a column in sql query?

    Hi, anyone knows how to get the value of a column in sql query?

    Here is my code, the value must be 1350079224397 in my PB, but I get 0

    QString query ("SELECT version FROM db_version");

    QVariant result = sda.execute (query);
    QVariantMap versionMap = result.toList () such () .toMap ();
    If (! versionMap.IsEmpty ())
    {
    qDebug()<"Version: "=""><>
    }

    OK, I have the solution

    QString query ("SELECT version as version FROM db_version");

  • How to choose the value of a string are numeric together and words of letters (for example, TEST)

    Hi all

    How to choose the value of a string are letters (for example, TEST) and all numeric...

    for example
    TEST 123456
    TEST 34567
    123456 ABCD
    1234 TEST
    TESTING 12345
    TEST 1@234$
    YOUR T 123456

    I want the results of the query as below.
    TEST 123456
    TEST 34567

    And I tried to use regexp_like in this case but without success. See the code below.
    SELECT * FROM TABLE WHERE regexp_like (Description, ' [TEST] % & [[: digit:]] + $');

    How can I do this, please answer.

    Thank you

    WF

    If you want to return only the rows that contain the string 'TEST', followed by zero or more space characters, followed by one or more digits?

    How about this:

    SELECT *.

    FROM my_table

    WHERE REGEXP_LIKE(description,'^TEST\s*\d+$')

  • How to get the value on a model that is defined in the java code in email

    Hello

    I created a custom code and send email as well to custom component. I can send emails using the method:

    InternetFunctions.sendMailTo (EmailID, EmailTemplate, subject, cxt);

    But my problem is that I have to get a value in the model of "EmailTemplate" which are defined from java code. but I don't know how to get the value.

    I will highlight in the java code by using this code: binder.putLocal ("ErrorApproveRejectMsg", massegeBody);

    I'm trying to enhance the model using the code below, but not able to get.

    1 < $exec getValue ("#active", "ErrorApproveRejectMsg") $ >

    2 < $exec getValue ("#active", ErrorApproveRejectMsg) $ >

    3 < getValue ("ErrorApproveRejectMsg") $exec $ >

    4 < $exec getValue (ErrorApproveRejectMsg) $ >

    5 < getValue ("#local", ErrorApproveRejectMsg) $exec $ >

    6 < getValue ("#local", "ErrorApproveRejectMsg") $exec $ >

    7 < $ErrorApproveRejectMsg$ >

    8 < $exec ErrorApproveRejectMsg$ >

    Assuming that cxt will be your Service or execution context object

    You can do something like this

    DB. PutLocal ("ErrorApproveRejectMsg", "Error");

    cxt.setCachedObject ("DataBinder", db);

    PageMerger h = new PageMerger (db, cxt);

    cxt.setCachedObject ("PageMerger", h);

    InternetFunctions.sendMailTo (usersEmail, emailTemplate, emailSubject, cxt);

    where db is current databinder object, and you can put any variable custom in the workbook by using the putLocal method.

    Thank you

    Vikram

  • How to get the value with DBSequence in EL links

    Hello

    I have a DBSequence type id and check if the value is null or positive

    #{bindings. Id.inputValue! = null and links. Id.inputValue > 0? {"Edit": "Create"} does not work because the links. Id.inputValue returns a DBSequence and cannot convert Long

    How to get the value?

    JDev 11.1.1.6

    You can try this:

    #{bindings. Id.inputValue.sequenceNumber.value! = null and links. Id.inputValue.sequenceNumber.value > 0? {'Edit': 'Create'}

    Jean Lou

  • How to get the value of a * Global * Application point of JS

    If we declare an element of the request, which is NOT a level of the page in question, how we get the value of this element in an Action dynamic JavaScript on a page?

    For example, we declare a "global" variable as an Application named DEFAULT_AJAX_SEPERATOR and set its value with a calculation of the claim "on the new Instance" a moment later, on a page of the application, we would like to get the value of DEFAULT_AJAX_SEPERATOR via JavaScript.

    Page* level syntax element...
    $v( 'DEFAULT_AJAX_SEPERATOR' );
    .. How does not work. I don't understand why it's like $v can only access the elements on the page. However, the APEX is clearly able to get these global values since, for example, they are available in PL/SQL blocks. Also, I know that it is on the session object, because I can see it when viewing the session.

    So... What is sauce secret for obtaining this value?

    Thank you

    -Joe

    Hello
    Use something like this in your javascript code.

    var appItemVal = "& DEFAULT_AJAX_SEPERATOR.";

    Thank you
    Naidu789.

    If you think, I responded to your question, please mark as answer.

Maybe you are looking for

  • Satellite C850D-104 - no boot HDD, no WEIRD boot, black screen

    Hi all I had a laptop Toshiba C850D-140, purchased approximately one to two years. I decided to reinstall Windows 7 and I started the whole process. Everything was good, the "expanding windows files" ball, completed successfully, then the laptop rest

  • A few questions after the downgrade of Win 7 on Satellite U940 - 11L

    Hello friend of mine bought the Toshiba Satellite U940 - 11L which had Windows 8 on it, due to some reasons that she wanted to have Windows 7 installed on it, which was pretty easy. Trouble came with the installation of the Symantec touchpad, after i

  • Re: Toshiba L305 Satellite 1) screen is messed up and only start in safe mode

    * HELP! * Windows starts only in safe mode or safe mode with network. My screen is messed up (black and gray with horizontal lines and the screen looks like it scrolls continuously). I connected the laptop to an external monitor and it still does not

  • Custom print sizes

    I have a Photosmart C6280 all-in-one. Over time, I've added several sizes in printing preferences. I want to remove them and start from scratch. I don't see how to do this. I tried a reset of the food, but they are still there. I'm running Windows 7

  • BlackBerry smartphones save BB on PC as a readable file

    Hello. I made the backup of the BB Desk Manager option on my pc, but when I want to open and view the file, I get the message that says: "this is not a valid Win32 application". Please let me know correct training step by step for this topic I need t