The possibility of declaring the variable on request?

Hello

With the help of Oracle 9i. I'm new to the PL/SQL (coming from c#), I would like to know if it is possible to declare a variable around the where it is used. For example, in the execution of the procedure block, suppose I want to do:

.. existing code...

vTest whole;
vTest: = 123;

.. existing code (continued)...

In doing so, the procedure could not compile. The only way I know to date is to declare the whole vTest. in the declaration block. Can you please let me know how to declare the variable in the body of the procedure?

Thanks in advance.

It is technically possible, but I wouldn't recommend it (I personally do not like this approach a LOT).

ME_XE?create or replace procedure testin  2  as  3  4     vparamone   number default 123;  5  6  begin  7  8     declare  9        vparamtwo   number default 456; 10     begin 11        vparamone   := vparamtwo; 12     end; 13     dbms_output.put_line(vparamone); 14  end; 15  /

Procedure created.

Elapsed: 00:00:00.29ME_XE?exec testin;456

PL/SQL procedure successfully completed.

Elapsed: 00:00:00.01ME_XE?

Tags: Database

Similar Questions

  • Is it possible to rename the variable loop for I?

    I do a lot of work with 2D arrays.  Sometimes, it would be useful when browsing the tables for one of the index named i and the other named j.  Is it possible to change the name of the variable increment other than what actually in another variable?

    Thnaks.

    Hummer1,

    As already said, there is no way to change the image of the final iteration.  However, you can add a description to the wire.  Click with the right button on the wire, then select "Description and Tip", type the name/description you want in the box.  Now you can move your mouse over the wire, and the description will appear in the context-sensitive Help window.  I hope this helps.

    Chris M

  • Declare the Variable step in a package

    Hello

    Is it obligatory to declare a variable in a package, even when we are refreshing or set the value of this variable in the package? What are the problems that occur in the case where a variable is not declared in the package?

    Please note that I understand that the variable must be romance in the package in case it is not be refreshed or set or incremented but is used by any step in the package.

    Thank you and best regards,

    PV

    Hi PV.

    You must declare a variable, unless it is explicitly used in the package to arm, refreshing or evaluate its value (as you mentioned).

    You must declare also specifically when:

    • You want its value to be passed during execution (runtime scenarios)
    • You want to use in the name of the resource to a data store in a scenario
  • It is possible to disable the windows password request for Windows 8?

    OT: password.

    It is possible to disable the windows password request for Windows 8?

    Hello

    Control Panel - Power Options - "require a password on wakeup" - value "need not."
    -Save the changes.

    Desktop computer (Windows key + D) - right click on an empty area - customize - lower right Screen Saver.
    Uncheck the box - the resume, login screen - APPLY - OK.

    ----------------------------------------------------------------------------------------------------

    How to make so that Windows 8 connect you to a user automatically at startup account
    http://www.eightforums.com/tutorials/2894-log-user-account-automatically-Windows-8-startup.html

    See #5

    Or use this method:

    How to turn on or off course connect by using Ctrl + Alt + Del in Windows 8
    http://www.eightforums.com/tutorials/5761-secure-sign-CTRL-ALT-DELETE-enable-disable-Windows-8-a.html

    Others:

    How to automatically log on to Windows 8 [direct access]
    http://www.AddictiveTips.com/Windows-Tips/how-to-automatically-login-to-Windows-8-direct-logon/

    Windows 8, how to connect automatically
    http://www.gHacks.NET/2011/09/16/Windows-8-How-to-automatically-log-on/

    I hope this helps.

    Rob Brown - Microsoft MVP<- profile="" -="" windows="" expert="" -="" consumer="" :="" bicycle=""><- mark="" twain="" said="" it="">

  • is it possible to pass the value of the variable validation function return Boolean message?

    Selection_012.pngSelection_013.png

    Assume that L_BATCH_NAME is the name of the variable which will receive the value as

    declare

    l_batch_name: = "NA";

    BEGIN

    L_BATCH_NAME: = FUNCTION (PARAMETERS);

    IF CONDITION > 0

    THEN

    RETURN FALSE;

    ON THE OTHER

    RETURN TRUE;

    END IF;

    END;

    Hi Reema,

    ReemaPuri wrote:

    Assume that L_BATCH_NAME is the name of the variable which will receive the value as

    declare

    l_batch_name: = "NA";

    BEGIN

    L_BATCH_NAME: = FUNCTION (PARAMETERS);

    IF CONDITION > 0

    THEN

    RETURN FALSE;

    ON THE OTHER

    RETURN TRUE;

    END IF;

    END;

    1. create a hidden item I say P1_HIDDEN_ITEM

    2 type the error message for this element in your process of

    declare
    l_batch_name:='NA';
    
    BEGIN
    :P1_HIDDEN_ITEM := FUNCTION(PARAMETERS);
    IF CONDITION > 0
    THEN
    RETURN FALSE;
    ELSE
    RETURN TRUE;
    END IF;
    END;
    

    3 and refer to this element hidden in the error message.

    Record for the batch '||&P1_HIDDEN_ITEM.||' already exists.
    

    Kind regards

    Jitendra

  • Set limits for requests for execution in the Variable Designer


    Hello world

    In Variable Calc Manager Designer, there is a place to enter within the limits of the variables.  I have currently a fast run time set up and I wonder if it is possible to give the user the ability to view all of the hierarchy of a dimension when prompted, but accept only level 0 members.  Right now, if I limit it to upgrade only 0 members, it is confusing to the end user because it is an endless list of members with no order.  So I want to be able to continue to use the hierarchy to navigate to the Member at level 0, but only accept it and run the rule if it is a 0 level.  Thanks for your help!

    Maybe you could be a condition in the calculation to accept only level 0.

    So if the user selects a level no 0 member the business rule will not run finished.

    An example would be:

    IF (@ISLEV ('dimension', 0))

    do something

    on the other

    do nothing

    endif

    I think you can have message appear with a function so that you can inform the user that the input value was not level 0

    Concerning

    Jimmy

  • Is it possible to create a variable that tells you what slides, the user has visited?

    Hello.

    I'm working on a project where I want a slide to display a button continue and hide the 2 areas of text, but ONLY when the user has already visited 2 other slides. I can only find variables indicating the slide the user previously visited.

    Is it possible to set a variable that does this?

    I want to create the following advanced measures:

    If the user has visited slides 62 AND 87, image_536 to show and hide text_caption_243 and text_caption_242

    I don't want action be executed if only 1 2 slide have been opened - it must occur when the two were opened.

    Hope that makes sense.

    I use 7 Captivate.

    Thank you.

    You will need two variables, it can be Boolean values. I will label them v_one and v_two with a default value of 0

    Because I don't know how the slides are formatted, do you use a Next button or are all visited media executives? You will need to have an event on the two blades to trigger an action:

    Assign the v_one with 1 slide 62

    And a similar action on the other slides to alternate v_two (do not use the toggle command, if the user accesses a slide twice, it could be toggled to 0).


    You do not specify where these text containers need to be (please, label your objects and slides)? But you'll need advanced conditional action triggered by another event somewhere:

    IF v_one is equal to 1 AND

    v_two is equal to 1

    See the Text1

    See the Text2

  • Possible to change the variable cpQuizInfoPassFail through advanced actions?

    Is it possible to change the variable cpQuizInfoPassFail through advanced actions? I do not see this or the other quizzing variable when I try to create an advanced action and change by entitlement or expression. Let me explain what I want to accomplish, I ask the wrong question. I have a training project, with that I need to include a post test. I don't really like the captivate quizzes. I want the post-test to play as a ride on jeopady where the user chooses issues category and gets points if the user answers correctly. For this I must ask questions on a game board and (from what I can fig) you cannot have multiple questions on the same page. I'm building the quiz with my own custom variables and coded so that the program jumps to a page of the certificate if the user gets more than 84 points. THA all works very well. But I have to be able to tell the database that the program will connect with the user has passed the quiz. I thought I could do this if I assign the value 1 to the variable cpQuizInfoPassFail. Is there a way to do this? Thanks in advance for any help,

    Doug Jackson

    Hi Doug,.

    I don't see the version you are using. Each interactive object can be marked, has a report following properties in the control panel (if you use CP5 or CP5.5) or a tab in the Properties dialog box reports, if you use a different version. You must add a score (default value is normally 1 point) and make sure you add it to the total score.

    If you want to make me a glance, post your file on acrobat.com (free, use your Adobe ID), share and publish. You will have a link that you can copy into a private message to me.

    Lilybiri

  • How to declare global variables with the help of another global variable in ODI

    I declare a variable gloabal using another global variable.
    Suppose for example that:

    I have a global variable empid.
    I'm decalaring an another global variable empname refreshing the global variables tab and select statement is

    Select empname emp where empno = #GLOBAL .empid - if I write like this I get the error message like character not valid.

    Select empname emp where empno = ' #GLOBAL.empid '-if I write like this I get the error message in the number not valid.

    I kept the datatype as digital and non-persistent action

    Help, please

    Thank you in advance.

    Hello

    You must perform this operation from a package.

    V1 (COOLING MODE) - OK---> V2 (REFRESH MODE)

    Thank you
    Fati

  • Declare the Variable global server which can be accessed in all reports

    Hello

    We use submodels that are imported in the model using:
    <? import: file: / / / D: / < path > / HeaderFooter.rtf? >

    I would like to have dynamics can see it, so that in case of change of the way, I have just
    Change it to the same place. I heard it is possible to define server variables in bi publisher who
    are available in all models?

    If so someone can tell me how to do this? or is there another way?

    would be very happy to advise.

    Thank you very much!

    Check out the following blog: http://bipconsulting.blogspot.com/2009/11/common-header-and-footer-with-sub.html

    Thank you!

  • Is it possible the reel with the variable column size?

    Hi, I'm queue to a CSV file with the following script (the SELECT real is different but similar, Oracle 10.2.0.3.0):
    SET COLSEP ';'
    SET FEEDBACK OFF
    SET LINESIZE 2000
    SET PAGESIZE 0
    SET TERMOUT OFF
    SET TRIMSPOOL ON
    SET VERIFY OFF
    
    SPOOL test.csv REPLACE
    
    SELECT 'COLUMN1', 'COLUMN2', 'COLUMN3' FROM dual UNION ALL
    SELECT 'value1', NULL, NULL FROM dual UNION ALL
    SELECT 'value2', NULL, NULL FROM dual;
    
    SPOOL OFF
    
    EXIT SUCCESS COMMIT
    Which produces the following output:
    COLUMN1;COLUMN2;COLUMN3
    value1 ;       ;
    value2 ;       ;
    Is it possible to get the following with the variable column size result
    COLUMN1;COLUMN2;COLUMN3
    value1;;
    value2;;
    I tried SET NULL "but I see no difference. Thanks in advance!

    Markus

    Hello

    SQL * Plus you button the output so that each column has a fixed length, which is exactly what you don't want.

    To get around this, concatenate all your data in a column VARCHAR2 fat with delimiters.

    For example, instead of

    SELECT    empno
    ,       ename
    ,       hiredate
    FROM       scott.emp
    ;
    

    Do something like

    SELECT    empno
    || ';' || ename
    || ';' || TO_CHAR (hiredate, 'DD-Mon-YYYY')
    FROM       scott.emp
    ;
    
  • the variables should be declared within spec PKG too?

    create or replace package test_pkg
    as 
    
    procedure test_proc (id in number, para2 in number default null );
    
    end;
    /
    
    
    create or replace package body test_pkg
    as 
    
    procedure test_proc (id in number, para2 in number default null)
    as 
     var1  varchar2();
     var2  varchar2();
     begin
       insert into tgt_tbl 
       select * from tabl1 where tbl1.col1 = id;
       
      
     end 
     
    
    
    
    my question is 
    
    - Do the variables needs to be declared in spec too ?? or is it not necessary to declare the variables in pkg spec, only parameters is fine  ???
    
    i,e var1 and var2 
    
    Thank you!!!
    Published by: user642297 on April 12, 2010 20:32

    Hello

    user642297 wrote:

    create or replace package test_pkg
    as 
    
    procedure test_proc (id in number, para2 in number default null );
    
    end;
    /
    
    create or replace package body test_pkg
    as 
    
    procedure test_proc (id in number, para2 in number default null)
    as
    var1  varchar2();
    var2  varchar2();
    begin
    insert into tgt_tbl
    select * from tabl1 where tbl1.col1 = id;
    
    end 
    
    my question is 
    
    - Do the variables needs to be declared in spec too ?? or is it not necessary to declare the variables in pkg spec, 
    

    It is not necessary to declare variables in the package specification. In fact, if you declare the variables var1 and var2 in package specifications, they will be different variables var1 and var2 in test_proc.

    Variables used only within a procedure must be declared in the procedure, like var1 and var2 in your example.
    The variables declared in the package body will be global to all, but not visible outside the package.
    Variables declared in the package specification will be visiible outside the package.

    only parameters is fine  ???
    
    i,e var1 and var2 
    

    Sorry, I don't understand the last part of the question.

    Moreover, few matter where you declare a VARCHAR2 variable (not an argument), you must specify the maximum length.
    For example

     var1  varchar2(100);
    
  • declare the variable binding

    I do homework here and ran into the wrong hope that someone here can help

    1. I thought that I understand the conscept of variable binding (which I think it is the same concept as the pointer in C/C++ programming), is that correct?

    2. I write the code and find the problem below, please point out what I did wrong?


    SQL & gt; describe the plants
    Name Null? Type
    ----------------------------------------- -------- ----------------------------
    PLANTID NOT NULL NUMBER (5)
    COMMONNAME NOT NULL VARCHAR2 (30)
    LIKE NOT NULL VARCHAR2 (30)
    SPECIES NOT NULL VARCHAR2 (30)
    FLOWERCOLOR VARCHAR2 (10)
    HEIGHT NUMBER (4.1)
    DATE OF ACQUIREDDATE
    LISTPRICE NUMBER (6.2)




    SQL & gt;
    declare


    bv_color variable varchar2 (10);
    v_price plants.listprice%Type;



    cursor cur_color is
    Select distinct lower (flowercolor) color
    plants;



    Start


    for rec_color looping cur_color

    : bv_color: = rec_color.color;



    Select avg (listprice)
    in v_price
    plants
    where lower (flowercolor) =: bv_color;



    dbms_output.put_line)
    "The average price for our plants with ' |: bv_color |"
    "flowers is $' | Round(v_price,2) | '.');
    dbms_output.put_line ('thank you');



    end loop;



    exception
    while others then
    dbms_output.put_line (' my exception:' | sqlcode |)
    ' : ' || SQLERRM);
    end;
    /
    SP2-0552: Bind "BV_COLOR" variable not declared.

    This is the way of declaring bind variables in SQL * more.

    In a PL/SQL block, you do not use bind variables like SQL * more. You just use normal variables. The PL/SQL engine is smart and sends SQL statements to the SQL engine containing all PL/SQL variables converted to bind variables. If it works transparent in PL/SQL and you don't have to do something more.

    Kind regards
    Rob.

  • Variable presentation for between the date of request

    Hello

    I have a requirement where I need to pass the value to the variables of presentation for "Between" date guests.

    Basically, a user can select two dates in the same column and see revenue between these two dates.

    The problem is that I can use a single column only once and if I do 'In between' then the 'set the variable' option disappeared.

    Kindly help me with the problem.
    Thank you.

    Vinay

    With regard to feeding guests, you don't have to use the same column. It is only when you filter your date column becomes important. With this, follow these steps:

    Place two columns in quick work space and use case WHEN 1 = 0 THEN... effectively dummy columns columns. Use the drop down menu to make the two guests "Edit box." Value of operand ' is equal to ' and prompts PVs: StartDate and EndDate. You can create session variables to set the default values. This method ignores the date columns and typed by the user to the value. Default dates show that the format users should use.

    Now in your request, click on the filter of your date column, convert the filter SQL and type:

    'Table Date.' ColumnName > = ' @{StartDate} "AND" table Date ".columnname"<=>

    It will work, but there are other options. If you want the user to select a date from a list drop-down, just use another date column that has dates available for the user to select. Once again you are simply feeding the Pvs in the guests. It is not necessary for the second column to be the same as the first.

  • How can I use a script to set the variables?

    I have a script to set a few variables and I need to run the script multiple times throughout the form, for different users at different times.  How can I configure the script as an object in the Variables and call it when I need to run it?  Appreciate all help.  I use SS3.

    var emailSubject = "";
    var cleanDate = Page1.EventDetails.Block2.SpeakingDate.rawValue.replace(/[\/]/g, "-");
    var eventName = Page1.EventDetails.Block1.EventName.rawValue;
    var eventCity = Page1.EventDetails.USaddress.CityEvent.rawValue;
    var eventState = Page1.EventDetails.USaddress.StateEvent.rawValue;
    emailSubject = cleanDate + " - " + eventName + " - " + eventCity + " - " + eventState;
    

    To create a function to be able to reuse the code easily right click in your hierarchy (for example, on your "form1"), click "insert a Script object.

    A new script object will be created, just rename it to something appropriate and then create a function both inside and

    function myFunction(var1,var2,var3){
    ' just an example '
    page1.textfield1.rawValue = var1 + var2 + var3
    }
    

    (I didn't fully understand the significance of the date and the event and the city, and exactly what your function is supposed to do, but it's how you declare a function).

    To call this function you simply reference as form1.scriptobjectname.myFunction(123,"asdf",variablename)

    (just one example of the possible arguments).

    I hope that's not too hard to follow,

    Best regards, Mattias

Maybe you are looking for

  • The iPhone has 7 tactile 3D?

    I can't find anywhere on the page that he touch 3D. Can someone please clear this up for me

  • Example: 15-af156sa: screenshot of Hp 15-af156sa

    Try everything to my knowledge but can't yet the screen turned on 15-af156sa with the help of win 10 would be great tnx

  • Blue screen at the end of Windows Update

    I have Windows updates the value allowing a manual download and install.  Today, when the icon appeared, there were 8 suggested files.  I downloaded and the window open during the installation Setup.  Approximately 98% of the 8th and last update (Mal

  • Replace a string in QML

    I want to enter a number of float as 3.42 in a textbox control. The problem is that the keypad has no period, so I wanted to do a simple thing like this on onChanged: var mytext = textfield.text; mytext.replace("*","."); textfield.text = mytext; (if

  • block websites Web of Cisco 800 series Router

    Hello I have a Cisco router running. I want to block certain websites (facebook, twitter, etc.) and download files with extensions such as *.AVI, *.mp3, *.mp4, *.exe, *.wma, *.wmv and *.torrent etc... I want to block for some users (based on the MAC