Bind variable vs. variable....

Hi ,
In the Oracle Master Glossary ... there is the following explanation about bind variable:
A variable in a SQL statement that must be replaced
with a valid value, or the address of a value, in order
for the statement to successfully execute
According to the above .. which is the difference between bind variable and variable....????
Tom Kyte in one , at least, of his book... points out to use the bind variables...not simple variables.
He also proves this using the following example:
tkyte@TKYTE816> set timing on
tkyte@TKYTE816> declare
2 type rc is ref cursor;
3 l_rc rc;
4 l_dummy all_objects.object_name%type;
5 l_start number default dbms_utility.get_time;
6 begin
7 for i in 1 .. 1000
8 loop
9 open l_rc for
10 ʹselect object_name
11 from all_objects
12 where object_id = ʹ || i;
13 fetch l_rc into l_dummy;
14 close l_rc;
15 end loop;
16 dbms_output.put_line
17 ( round( (dbms_utility.get_time‐l_start)/100, 2 ) ||
18 ʹ seconds...ʹ );
19 end;
20 /
14.86 seconds...[[/b]pre]
And using bind variables
tkyte@TKYTE816> declare
2 type rc is ref cursor;
3 l_rc rc;
4 l_dummy all_objects.object_name%type;
5 l_start number default dbms_utility.get_time;
6 begin
7 for i in 1 .. 1000
8 loop
9 open l_rc for
10 ʹselect object_name
11 from all_objects
12 where object_id = :xʹ
13 using i;
14 fetch l_rc into l_dummy;
15 close l_rc;
16 end loop;
17 dbms_output.put_line
18 ( round( (dbms_utility.get_time‐l_start)/100, 2 ) ||
19 ʹ seconds...ʹ );
20 end;
21 /
1.27 seconds...I'm confused as in my PL/SQL programs i do not use of course literal values but 'simple variables' not 'bind variables'....
Should i replace all uses and occurences of 'simple variables' with bind variables...?????
Thanks....a lot
Sim

No need for something as complex as SQL tracing. Simply look in the shared pool. E.g.
SQL> create or replace procedure foo2 is
2 n number := 1;
3 c number;
4 begin
5 select
6 count(*) into c
7 from dept
8 where deptno = n;
9 end;
10 /
Procedure created.
SQL> -- we flush the shared pool and remove cached cursors
SQL> alter system flush shared_pool;
System altered.
SQL> -- is there a cursor in the shared pool using DEPT as our stored proc is using?
SQL> select
2 sql_text
3 from v$sqlarea
4 where sql_text like UPPER('%dept%')
5 and sql_text not like '%v$sqlarea%';
no rows selected
SQL> -- we execute our stored proc which will cause our SQL in that stored proc to be cached
SQL> exec Foo2
PL/SQL procedure successfully completed.
SQL> -- do we see our stored proc's SQL in the shared pool using a bind variable?
SQL> select
2 sql_text
3 from v$sqlarea
4 where sql_text like UPPER('%dept%')
5 and sql_text not like '%v$sqlarea%';
SQL_TEXT
SELECT COUNT(*) FROM DEPT WHERE DEPTNO = :B1
SQL>

Similar Messages

  • Binding a JavaFX variable to a Java class instance variable

    Hi,
    I am pretty new to JavaFX but have been developing in Java for many years. I am trying to develop a JavaFX webservice client. What I am doing is creating a basic scene that displays the data values that I am polling with a Java class that extends Thread. The Java class is reading temperature and voltage from a remote server and storing the response in an instance variable. I would like to bind a JavaFx variable to the Java class instance variable so that I can display the values whenever they change.
    var conn: WebserviceConnection; // Java class that extends Thread
    var response: WebserviceResponse;
    try {
    conn = new WebserviceConnection("some_url");
    conn.start();
    Thread.sleep(10000);
    } catch (e:Exception) {
    e.printStackTrace();
    def bindTemp = bind conn.getResponse().getTemperature();
    def bindVolt = bind conn.getResponse().getVoltage();
    The WebserviceConnection class is opening a socket connection and reading some data in a separate thread. A regular socket connection is used because the server is not using HTTP.
    When I run the application, the bindTemp and bindVolt are not updated whenever new data values are received.
    Am I missing something with how bind works? Can I do what I want to do with 'bind'. I basically want to run a separate thread to retrieve data and want my UI to be updated when the data changes.
    Is there a better way to do this than the way I am trying to do it?
    Thanks for any help in advance.
    -Richard

    Hi,
    If you don't want to constantly poll for value change, you can use the observer design pattern, but you need to modify the classes that serve the values to javafx.
    Heres a simple example:
    The Thread which updates a value in every second:
    // TimeServer.java
    public class TimeServer extends Thread {
        private boolean interrupted = false;
        public ValueObject valueObject = new ValueObject();
        @Override
        public void run() {
            while (!interrupted) {
                try {
                    valueObject.setValue(Long.toString(System.currentTimeMillis()));
                    sleep(1000);
                } catch (InterruptedException ex) {
                    interrupted = true;
    }The ValueObject class which contains the values we want to bind in javafx:
    // ValueObject.java
    import java.util.Observable;
    public class ValueObject extends Observable {
        private String value;
        public String getValue() {
            return this.value;
        public void setValue(String value) {
            this.value = value;
            fireNotify();
        private void fireNotify() {
            setChanged();
            notifyObservers();
    }We also need an adapter class in JFX so we can use bind:
    // ValueObjectAdapter.fx
    import java.util.Observer;
    import java.util.Observable;
    public class ValueObjectAdapter extends Observer {
        public-read var value : String;
        public var valueObject : ValueObject
            on replace { valueObject.addObserver(this)}
        override function update(observable: Observable, arg: Object) {
             // We need to run every code in the JFX EDT
             // do not change if the update method can be called outside the Event Dispatch Thread!
             FX.deferAction(
                 function(): Void {
                    value = valueObject.getValue();
    }And finally the main JFX code which displays the canging value:
    // Main.fx
    import javafx.stage.Stage;
    import javafx.scene.Scene;
    import javafx.scene.text.Text;
    import javafx.scene.text.Font;
    import threadbindfx.TimeServer;
    var timeServer : TimeServer;
    var valueObjectAdapter : ValueObjectAdapter = new ValueObjectAdapter();
    timeServer = new TimeServer();
    valueObjectAdapter.valueObject = timeServer.valueObject;
    timeServer.start();
    Stage {
        title: "Time Application"
        width: 250
        height: 80
        scene: Scene {
            content: Text {
                font : Font {
                    size : 24
                x : 10, y : 30
                content: bind valueObjectAdapter.value;
    }This approach uses less cpu time than constant polling, and changes aren't dependent on the polling interval.
    However this cannot be applied to code which you cannot change obviously.
    I hope this helps.

  • Pl/sql : bind, host & define variables

    what is difference between bind variable, host variable and define variable (i.e. variable created using DEFINE command) ? In what situation each of these variables are used?

    http://asktom.oracle.com
    for bind variable see the following link
    http://asktom.oracle.com/pls/ask/f?p=4950:8:4466155959264239264::NO::F4950_P8_DISPLAYID,F4950_P8_CRITERIA:668624442763,

  • Use buffering and psp with datasocket-VIs and without any binding and shared variable node

    Hello,
    I'm using LV 8.5.
    I'm trying to develop a multiplatform (windows and mac os x) and multi-computer application. II want to get executables running on each device, communicating through the network. Communication process includes datas (such as images) and events messages (something like "Hello, I got an error" or "youyou, my work is done" or "I'm hereeeee!!!!...."). I do need a communication without any loss of data.
    I worked a lot and wanted to test a psp-based design, without any binding nor shared variable node (mac os...) using data socket VIs and SVE buffering.
    I managed to :
    - deploy shared variable library dynamically (even in an executable)
    - communicate between two PCs with datasocket VIs
    However, I never managed to enjoy buffering (even locally with one VI doing the deployment and writing datas and another one for reading).
    I worked hard (dynamic buffering setting, dynamic buffering watching like in  http://zone.ni.com/reference/en-XX/help/371361D-01/lvconcepts/buffering_data/ and in the example "DS send image" and "DS receive image" in the labview examples, trying to use "?sync=true" in the URL, etc...) but no way to get things work.
    I attached a jpeg of an example of receiver and sender. I use wait commands in both receiver and sender to test buffering
    Receiver do receive datas (the last written) but buffering doesn't work.
    Did somebody did that before ? (better than me...)
    Thanks
    Bo
    Attachments:
    Sender.JPG ‏87 KB
    Receiver.JPG ‏96 KB

    Hello,
    Indeed my problem has been solved. My error : in the While loop of the receiver VI, I always reactualize the PacketsMaxBuffer and OctetsMawBuffer parameters, what resets the buffer and make it appears ineffective.
    I now set  the PacketsMaxBuffer and OctetsMawBuffer values only once at the begining of the VI and the psp buffering works perfectly.
    Sorry for the desagreement...
    Bo

  • How to get Request Variables in Variables-View

    while editing a jsp-page i always can see the "Session Variables" in variables-view (left down corner of eclipse above tag libraries). also while working with forms i can see all available form variables for the as "Page Variables".
    but what i really would need is to see the available "Request Variables" which are set by the action calling the page.
    what do i have to do, to make this running?
    tnx in advance
    Rel
    //deny everything!

    Here comes the action config...
         <action-mappings>
              <action path="/area_rosa_news" type="mvc.actions.site.news.area_rosa_newsAction" parameter="area_rosa_news">
                   <forward name="area_rosa_news" path="area_rosa_news" contextRelative="false"></forward>
              </action>
         </action-mappings>

  • Error while using the variable name "VARIABLE" in variable substitution

    Hi Experts,
      I am using variable substitution to have my output filename set as a payload field value. It is working fine when I am using the variable name as fname, subs etc but channel goes in error when I am using the variable name as "VARIABLE". This is probably a reserved word but i would like to know where i can find a detailed documentation on this. Say things to note / restrictions while using variable substitution.
    This is the error in the channel:
    Message processing failed. Cause: com.sap.aii.af.ra.ms.api.RecoverableException: Error during variable substitution: java.text.ParseException: Variable 'variable' not found in variable substitution table: com.sap.aii.adapter.file.configuration.DynamicConfigurationException: Error during variable substitution: java.text.ParseException: Variable 'variable' not found in variable substitution table
    Thanks,
    Diya

    Hi Zevik,
    Thanks for the reply. The output file is created correctly by merely changing the variable name to something else and hence the doubt.
    Below is the configuration:
    Variable Substituition
    VARIABLE    payload:interface_dummy,1,Recordset,1,Header,1,field1,1
    Filename schema : TEST_%VARIABLE%.txt
    Output xml structure:
    <?xml version="1.0" encoding="utf-8" ?>
    - <ns:interface_dummy xmlns:ns="http://training.eu.unilever.com">
    - <ns:Recordset xmlns:ns="http://training.eu.unilever.com">
    - <Header>
      <identifier>HDR</identifier>
      <field1>001</field1>
      <field2>001</field2>
      <field3>R</field3>
      </Header>
    - <Detail>
      <identifier>A</identifier>
      <field1>000000002</field1>
      <field2 />
      <field3>Doretha.Walker</field3>
      </Detail>
    I thimk my configuration is correct as it is working correctly with the variable name change, However, maybe i missed something !

  • Changing a variable in variable screen

    Hey everybody,
    i have a question for variable screen in Bex Analyzer 3.5 in BI 7.0.
    Is it possible to change a variable in variable screen depending the input of an other variable?
    I know how to change it bevor popup and after popup.
    But i want to change the date of a hierarchy-variable depending of the values entered of two other variables. so, as soon as the variable of date or month is changed, i would like to match the hierarchy-date of a variable.
    Anybody an idea?

    Hey Vikash,
    thanks for the link, but I quess, that doesn't help. We have allready a keydate-userexit-variable, that is filled after popup (i_step=2). I Know how to do ist also bevor popup (i_step=1).
    What I need is to change a variable "during" popup. That means, the variable screen is open, and the user enters variable number 1. As soon as he did an input, I want to react on this "event" and change a other variable. (In our case, a hiararchydate, so that he can choose from the right hiararchy).
    I read that the variable screen of Bex 3.5 in BI 7.0 has an other technoloy than in before. (Html-Based). I hoped that there is a new chance of working whitch the variables in Bex.
    I little example.
    the variables screen pops up with some default value:
    year (2008)
    month (12)
    ConsolidationUnit ( )
    (hierarchyVariable with keydate 31.12.2008 when you open F4-Screen)
    now, the user changes the first variable into year 2009 an presses enter, but he don't execute the query yet, because he wants to choose a consolidationunit first.
    In this moment, i whant to change the Keydate from Consolidationunit-variable
    year(2009)
    month(12)
    ConsolidationUnit
    (HierarchyVariable with keydate 31.12.2009 when you open F4-Screen)
    The consunit he wants to choose is not available in Hierarchy from 2008.
    Thats our Problem.
    I want to avoid, that the user has to type in an other variable for keydate of the hiearchy. because the keydate depends on the other entered time-variables.
    Hope, that this is comprehendible. I try to realize somekind of an interaction between variables in the screen.
    Kind regards,
    Amina

  • Description for Variable in variable screen

    Hi Forum,
    I am using variables type "Replacement Path" in a query for 0FISCYEAR and 0FISCPER3 through by another variable for 0FISCPER.
    The variables are functioning well, but in the screen of entrance of variables, the variable for 0FISCPER display the technician name instead of the description.
    Many thanks in advance for any idea.
    Kind regards,
    Joã

    Hi Supraja,
    Thanks for your help.
    However my problem is like Tobias Vogt problem posted Jan 30, 2009 10:49 AM (Technical description in variable screen for replacement path variable).
    ""There's a query that is used as stand alone and as a target of RRI from another query.
    Because the source query provides a time-interval and the target query should only use
    the upper value, I've used a variable1 of type replacement path to be replaced by another variable2.
    That's working quite well. But unfortunately, the technical description of variable2 is shown on variable input screen.
    Does anyone know how the technical description can be replaced by a text description?""
    Read this link
    João Alvarez

  • Read LabVIEW shared variables ( network variables?) with VB6

    Hi, i need to read some LabVIEW shared variables (network variables?) using a VB6 program.
    Is it possible?
    I think that yes, using Measurement Studio for VB6 but I don't know how and I haven't found information in the  Measurement Studio for VB6 help file
    Could some one send me a program example or explain me how it is possible to read LabVIEW shared variables fromVB6?

    Hello quintella,
    To be able to interface with LabVIEW
    Shared Variables with Visual Basic 6 you will need to use NI Measurement
    Studio, which ships with examples on how to use VB6 with DataSocketing. Apart
    from Data Sockets, if you are using Measurement Studio 8.1 or higer, with the
    Network Variable Library introducted in NI Measurement Studio 8.1, you can read
    and write to shared variables in ANSI C, Visual Basic .NET or Visual C#. (http://zone.ni.com/devzone/cda/tut/p/id/4679)
    Here you have two links where you can
    find more information about how to use the datasocket option. In addition, there
    are several examples included in Measurement Studio with Network Variables and
    Datasocket.
    http://forums.ni.com/ni/board/message?board.id=230&message.id=2945&requireLogin=False
    http://forums.ni.com/ni/board/message?board.id=230&message.id=3324&requireLogin=False
    Regards,

  • Variable of variable concept in AS

    Hi,
    In flex how can i use the variable of variable concept , i
    want to create the dynamic instance for ArrayCollection class like
    below ,
    for(var i:int=1;i < 3; i ++){
    var objname = "ArrCol"+i;
    objname:ArrayCollection = new ArrayCollection();
    Expected Result :
    ArrCol1 , ArrCol2 these two instance should be created .....
    Any ideas plz let me know ,

    Sorry, i did that from memory, and too quickly.
    The bracket notation will only create an Object, but since
    almost everything else extends object, this is not really a
    problem.
    change the line to this:
    this[sObjname] = new ArrayCollection();
    The newly created instance variable will contain an
    ArrayCollection. You *might* need/want to cast it to Array
    collection using "as" when you go to use the var:
    var acTemp:ArrayCollection = this[sObjname] as
    ArrayCollection;
    Tracy
    Tracy

  • Save setting for - Display Personalized variables on variable screen

    Hi,
    Good Morning.
    I have got a variant. After I select a variant I went to Personalization screen. In this screen after selecting a couple of variables I unchecked/unmarked check box for 'Display personalization variables on variable screen'. I clicked on Ok and also saved tha variant (overwrite).
    But the next time I open the query this check box remains unchecked and all the personalized variables are visible.
    Can you please help me in resolving this?
    Thanks & Regards,
    Raj

    Dear Rajendra,
    check this link..it might help u,,,
    http://help.sap.com/saphelp_nw04s/helpdata/en/45/6e4f4db9cc1956e10000000a11466f/frameset.htm
    Hope this helps u.
    Best Regards,
    VVenkat..

  • Variable of variables

    Hi,
    It is a little bit difficult to explain my problem but I give it a try. I'm developing a Java application with Swing components, and I don't use visual builders. In that application I use many JTextField (approx. 15), but there might be more in time. These textfields have all the same initial text. And here comes my problem. To initialize the textfields one-by-one it's a little bit "ugly" and tiring for me. So I ask all the professional developers: is there a way to do such thing in a loop? I also use PHP and in it there is a possibility to use variable of variables. I've never met such a thing in Java so I ask You. To make it more clear, I'd like something like this (the following code is fictional and non-working of course):
    for(int x=0;x<15;x++)
    JTextField tf+x=new JTextField("hello");
    If it worked I'd be happy but there is no such solution in Java. Is there any other way?

    If it worked I'd be happy but there is no such solution in Java. Is there any other way?
    Well, the blindingly obvious solution is this,
    JTextField[] fields = new JTextField[numFields];
    for (int i = 0; i < fields.length; i ++)
        fields[i] = new JTextField(defaultString);
    }

  • Front Panel binding of shared variables very slow initialization / start

    Hello @ all,
    I am using a server running Windows2000 and LV 8 DSC RTS for datalogging. All shared variables are deployed on that server.
    I am now facing the problem, that all front panels running on the clients using the network shared variables on the server take very long to sync on startup. First the flags on the controls bind to the shared variables turn red, after up to ten minutes they start to turn green. The panels use up to 40 controls bind to the shared variables.
    All firewalls are turned off. I tried to connect the client to the same switch the server is connected to. Same problem. Does anybody have a clue?
    Thx for your quick answers.
    Carsten 

    While I can't offer any solution to your problem, I am having a similar issue running LV8.0 and shared variables on my block diagram (no DSC installed).
    When using network published shared variables, it takes anywhere from 30 sec to 4 min from the vi start for any updates to be seen. Given enough time, they will all update normally, however this 4 minute time lag is somewhat troublesome.
    I have confirmed the issue to be present when running the shared variable engine on windows and RT platforms, with exactly the same results.
    In my case, the worst offenders are a couple of double precision arrays (4 elements each). They will normally exhibit similar "spurty" behavior on startup, and eventually work their way up to continuous and normal update rates. Interestingly enough there are no errors generated by the shared variables on the block diagram.

  • Binding a shared variable to a NI-PSP data object does not work

    Hi,
    I want to share data between a RT-target and one or more hosts (LV 8.6.1). The network shared variables are deployed to the RT-Target.  According to NI accessing shared variables from another project or host has to be done by defining a shared variable on the host and aliasing it to the NI-PSP data object on the target.
     I did that and the host shared variable generated an error (0x8BBB0011) during runtime.
    Next I aliased to a shared variable deployed on the host from another project. This did work.
    Another thing I tried was to bind the variable from the RT-target to a display element:
    This is working !!! And as you can see the path of the NI-PSP data object is exactly the same ! So what is the difference between binding a data object to a shared variable and to a display element?
    Is there a bug in the SVE or am I missing something here?
    The host project:
    The publisher VI
    Hope, someone has an answer.
    Regards
    Matthias Quade
    Solved!
    Go to Solution.
    Attachments:
    AliasTestWrite-RT.vi ‏8 KB
    AliasTestConsumer.vi ‏8 KB

    Dear Mr. Quade,
    thank you for posting at the National Instruments Forum. There is a known issue with the path of the bound variable with LabVIEW 8.6.1
    Please download the patch for LabVIEW 8.6.1, it should solve your problem:
    http://joule.ni.com/nidu/cds/view/p/id/1255/lang/de
    Best regards from Munich
    MarianO

  • How to bind a VO :variable in a WHERE clause to a page parameter

    Hello,
    I have a VO. This VO has a variable :v in the WHERE clause of the query.
    This VO is used by different UI components in a page (a table, a tree). The page already has a parameter defined in his properties #{viewScope.myparam}
    What I want is to bind :v to the #{viewScope.myparam}, so that I can specify :v from a parameter in the URL, so that the table immeditaly shows the proper results.
    Is there a way to Bind :v to #{viewScope.myparam} directly in the VO definition in the model project? (It seems it is not possilble)
    The other alternative is to use ExecuteWithParams, but in this case I do not know how to perform the query without user actions in a trasparent way. I dont want to associate execute operations to UI components.
    thanks

    Hi,
    +Is there a way to Bind :v to #{viewScope.myparam} directly in the VO definition in the model project? (It seems it is not possilble)+
    No, this can't be done
    The other alternative is to use ExecuteWithParams, but in this case I do not know how to perform the query without user actions in a trasparent way. I dont want to associate execute operations to UI components.
    If you are within a bounded task flow or in an unbounded task flow that does not have this page as its first view (home page) then you can drag and drop executeWithParams as a method call activity. The attribute then should be saved in the pageFlowScope (not the viewScope).
    In addition I would use a ViewCriteria instead of "hard wiring" the bind variable to the VO definition. You can then - in the AM data model section - associate the View Criteria with the VO instance yo use in the UI
    Frank

Maybe you are looking for

  • HT4623 hy i need help i want to downgrade my iphone 4 from ios 6.0.1 to 5.1.1 how can i do because i dont like the ios 6.

    hy i need help i want to downgrade my iphone 4 from ios 6.0.1 to 5.1.1 how can i do because i dont like the ios 6. pls help thank

  • How do you print a scrollable input frame?

    Hello, I am working on a mac and using InDesign CC 2014 and Acrobat XI Pro. I have created an interactive form in InDesign and exported it as a interactive PDF. I have created scrollable input frames. Great for input, and on the screen in general, bu

  • Create an internal table with the rows of another internal table.

    Hi I want to know if posible to create an internal table structure with the  rows of another internal table? ex. If in i_tab column A has this values: row 1 = first, row 2 = second, row 3 = third. Now I want that the structure of my internal table be

  • Pulling Text From A Picture

    i have a website that i am redesigning. The website is made up of png images. unYaaaaY!!!!! A friend said that there was a way that i could use illustrator to pull the text from the png and copy to pages for editing. He cant remember how it was done

  • Video on my Black Berry Flip

    I"m trying to get video converted correctly on my Black Berry flip phone, but I can't seem to figure out how to convert the video with the Roxio Media manager so that the video is saved sideways.. So when I play it in my Black Berry Flip it fills up