Anonymous block Source code

How can I request/access to the source code of an anonymous block? For example, if I want the source of a particular procedure, it is accessible from the table 'all_source. Even if she throws the source for an anonymous block after it is done with her, always store it somewhere while it's executing analysis, it should at least be accessible as part of the package as follows:
declare
    src_code varchar2;
begin
    select source
    into   src_code
    from   wherever the DB stores it;

    dbms_output.put_line(src_code);
end;

How can I request/access to the source code of an anonymous block

If you give the anonymous block a unique label, you might be able to query v$ sql:

SQL> col guid new_val guid
SQL>
SQL> select sys_guid() guid from dual
  2  /

GUID
--------------------------------
C418F340066DF07FE04017AC25922063

SQL>
SQL> declare
  2    sql_text   long;
  3    label      long := '&&guid';
  4  begin
  5    select sql_fulltext
  6      into sql_text
  7      from v$sql
  8     where sql_fulltext like '%' || label || '%';
  9
 10    dbms_output.put_line ('SQL of anonymous block:');
 11    dbms_output.put_line (sql_text);
 12  end;
 13  /
old   3:   label      long := '&&guid';
new   3:   label      long := 'C418F340066DF07FE04017AC25922063';
SQL of anonymous block:
declare
  sql_text   long;
  label      long := 'C418F340066DF07FE04017AC25922063';
begin
  select sql_fulltext
    into sql_text
    from v$sql

where sql_fulltext like '%' || label || '%';

  dbms_output.put_line ('SQL of anonymous block:');
  dbms_output.put_line (sql_text);
end;

PL/SQL procedure successfully completed.

SQL>

Tags: Database

Similar Questions

  • Real-time application does not work; source code works very well

    The short version is I'm programming a cRIO and apparently the RT code isn't running after you deploy, and I can't understand why. It is further complicated as I do all this remote and I don't have direct access to the unit since I am 500 miles away. I work through a couple of other guys who know some LabVIEW, but neither is working on the site so that they explicitly trip there whenever I have a bright idea.

    I was there a few weeks ago. During this time, I created a code simple cRIO, since I'm new to the cRIO, allowing the user to move a control and change a chart. It worked fine, but I must stress that it did not have a FPGA component. After that, I worked on the actual code, which reads some sensors, displays the results on a user interface and stores the results. Did FPGA. I used it in the LabVIEW environment and it worked fine, but I ran out of time before I could finish a release build and deploy the RT as a compiled application. I sent them the version later, my contact deployed but had the network stream errors during execution of the user interface.

    After hours to address network problems and sending over debug versions, I tried to create a log on RT level so I could see what was going on. The journal is not yet open, even if it is the first command in the code. I have pores through the forums and found http://forums.ni.com/t5/LabVIEW/cRIO-Troubleshooting-creation-and-deployment-of-startup/td-p/1956475... which took a new direction.

    I had my contact use the RT debug console and when it pulls up to the front of the RT, it shows an arrow broken at delivery. He clicked and nothing happens - no work, no list of bugs. If he shoots to the top of the list of bugs manually, it is empty. Again, the RT works very well if you run it through LabVIEW and not as an application compiled in real-time. He also noticed that the open FPGA VI was grey on the block diagram. Are no other icons.

    If the problem seems to be that the compiled application of RT becomes some kind of error, but do not tell me what it is, and it seems to be related to the opening of the FPGA. I recompiled the FPGA and RT. I recompile the RT himself, but not the FPGA, because this would take hours. It is download everything properly for the cRIO. The RT is set to run automatically. It is restarted the cRIO whenever he deploys the RT. They have LabVIEW on a computer, but it doesn't have the correct drivers to run the code of the environment of LV. I am to resist have them install the dirvers because downloading big files is complicated due to the restrictions of security as well as a lousy connection at a remote site. In addition, it does not solve the problem of RT executable doesn't work is not the same as the source code, which, according to the thread above, seems to be a thing.

    The last thing I'm getting is that I sent her instructions for how to build a source distribution of the project that I sent and try to deploy on the cRIO. Even if it works, I'm not sure that this is an acceptable solution, because I assume running VI, rather than the EXE is slower, and they need to speed on this project.

    Simply, I don't know where to go from here. I probably need to get direct access to the cRIO and I might be able to convince them to ship to me so I can understand this point, but I don't know where I got same departure other than the Voodoo debugging standard of "trying stuff randomly until something works". I am open to suggestions, if someone managed to solve this before.

    Code snippet of the first part of the project is fixed, although I don't know how much what good it will do. I am really confused, and the customer is frustrated with how much budget is going to solve this problem.


  • Change of anonymous block to a stored procedure

    Hi, how can I modify this code to become a procedure stored instead of anonymous block. I need to pass the parameters on a regular basis. which means that I have to perform the procedure on a daily basis with specific parameters. I am running Oracle 11 g and coding with plsql. Thanks in advance for your help.

    DECLARE
      /*Your query as cursor */
      CURSOR emp_cur IS
        SELECT ename, sal FROM emp;

      /*UTL_SMTP related varriavles. */
      v_connection_handle  UTL_SMTP.CONNECTION;
      v_from_email_address VARCHAR2(30) := '[email protected]';
      v_to_email_address   VARCHAR2(30) := 'yyyy@[qr.com';
      v_smtp_host          VARCHAR2(30) := 'x.xxx.xxx.xxx'; --My mail server, replace it with yours.
      v_subject            VARCHAR2(30) := 'Your Test Mail';
      l_message            VARCHAR2(200) := 'This is test mail using UTL_SMTP';

      /* This send_header procedure is written in the documentation */
      PROCEDURE send_header(pi_name IN VARCHAR2, pi_header IN VARCHAR2) AS
      BEGIN
        UTL_SMTP.WRITE_DATA(v_connection_handle,
                            pi_name || ': ' || pi_header || UTL_TCP.CRLF);
      END;

    BEGIN

      /*UTL_SMTP related coding. */
      v_connection_handle := UTL_SMTP.OPEN_CONNECTION(host => v_smtp_host);
      UTL_SMTP.HELO(v_connection_handle, v_smtp_host);
      UTL_SMTP.MAIL(v_connection_handle, v_from_email_address);
      UTL_SMTP.RCPT(v_connection_handle, v_to_email_address);
      UTL_SMTP.OPEN_DATA(v_connection_handle);
      send_header('From', '"Sender" <' || v_from_email_address || '>');
      send_header('To', '"Recipient" <' || v_to_email_address || '>');
      send_header('Subject', v_subject);

      --MIME header.
      UTL_SMTP.WRITE_DATA(v_connection_handle,
                          'MIME-Version: 1.0' || UTL_TCP.CRLF);
      UTL_SMTP.WRITE_DATA(v_connection_handle,
                          'Content-Type: multipart/mixed; ' || UTL_TCP.CRLF);
      UTL_SMTP.WRITE_DATA(v_connection_handle,
                          ' boundary= "' || 'SAUBHIK.SECBOUND' || '"' ||
                          UTL_TCP.CRLF);
      UTL_SMTP.WRITE_DATA(v_connection_handle, UTL_TCP.CRLF);

      -- Mail Body
      UTL_SMTP.WRITE_DATA(v_connection_handle,
                          '--' || 'SAUBHIK.SECBOUND' || UTL_TCP.CRLF);
      UTL_SMTP.WRITE_DATA(v_connection_handle,
                          'Content-Type: text/plain;' || UTL_TCP.CRLF);
      UTL_SMTP.WRITE_DATA(v_connection_handle,
                          ' charset=US-ASCII' || UTL_TCP.CRLF);
      UTL_SMTP.WRITE_DATA(v_connection_handle, UTL_TCP.CRLF);
      UTL_SMTP.WRITE_DATA(v_connection_handle, l_message || UTL_TCP.CRLF);
      UTL_SMTP.WRITE_DATA(v_connection_handle, UTL_TCP.CRLF);
      FOR i IN emp_cur LOOP
        UTL_SMTP.WRITE_DATA(v_connection_handle,
                            i.ename || '--' || i.sal || UTL_TCP.CRLF);
     
      END LOOP;

      UTL_SMTP.WRITE_DATA(v_connection_handle, UTL_TCP.CRLF);

      -- Close Email
      UTL_SMTP.WRITE_DATA(v_connection_handle,
                          '--' || 'SAUBHIK.SECBOUND' || '--' || UTL_TCP.CRLF);
      UTL_SMTP.WRITE_DATA(v_connection_handle,
                          UTL_TCP.CRLF || '.' || UTL_TCP.CRLF);

      UTL_SMTP.CLOSE_DATA(v_connection_handle);
      UTL_SMTP.QUIT(v_connection_handle);
     
    EXCEPTION
      WHEN OTHERS THEN
        UTL_SMTP.QUIT(v_connection_handle);
        RAISE;
    END;

    CREATE OR REPLACE PROCEDURE BDA. PR_SEND_EMAIL

    (p_from_email_address VARCHAR2

    p_to_email_address VARCHAR2

    p_smtp_host VARCHAR2

    p_subject in VARCHAR2 DEFAULT "Test E-mail"

    p_message VARCHAR2 DEFAULT ' is the TEST mail with the help of UTL_SMTP "

    )

    IS

    / Request as cursor * /.

    CURSOR emp_cur IS

    SELECT ename, sal FROM emp;

    / * Related UTL_SMTP varriavles. */

    v_connection_handle UTL_SMTP. CONNECTION;

    / * This procedure of send_header is mentioned in the documentation * /.

    PROCEDURE send_header (pi_name IN VARCHAR2, pi_header IN VARCHAR2) AS

    BEGIN

    UTL_SMTP. WRITE_DATA (v_connection_handle, pi_name |) ': ' || pi_header | UTL_TCP. CRLF);

    END;

    BEGIN

    / * Associated with coding UTL_SMTP. */

    v_connection_handle: = UTL_SMTP. OPEN_CONNECTION (host-online p_smtp_host);

    UTL_SMTP. HELO (v_connection_handle, p_smtp_host);

    UTL_SMTP. MAIL (v_connection_handle, p_from_email_address);

    UTL_SMTP. RCPT (v_connection_handle, p_to_email_address);

    UTL_SMTP. OPEN_DATA (v_connection_handle);

    send_header ('from', "" sender" <' ||="" p_from_email_address="" ||="" '="">" ");

    send_header ('To', ' "receiver" <' ||="" p_to_email_address="" ||="" '="">"");

    send_header ('Subject', p_subject);

    -MIME header.

    UTL_SMTP. WRITE_DATA (v_connection_handle, "MIME-Version: 1.0 ' |") UTL_TCP. CRLF);

    UTL_SMTP. WRITE_DATA (v_connection_handle, ' Content-Type: multipart/mixed;) ' || UTL_TCP. CRLF);

    UTL_SMTP. WRITE_DATA (v_connection_handle, ' boundary = "' | '") CARINE. SECBOUND' | '"' || UTL_TCP. CRLF);

    UTL_SMTP. WRITE_DATA (v_connection_handle, UTL_TCP. CRLF);

    -Body of the message

    UTL_SMTP. WRITE_DATA (v_connection_handle, '-' |) "JOHAN. SECBOUND' | UTL_TCP. CRLF);

    UTL_SMTP. WRITE_DATA (v_connection_handle, ' Content-Type: text/plain;) "|| UTL_TCP. CRLF);

    UTL_SMTP. WRITE_DATA (v_connection_handle, 'charset = US-ASCII' |) UTL_TCP. CRLF);

    UTL_SMTP. WRITE_DATA (v_connection_handle, UTL_TCP. CRLF);

    UTL_SMTP. WRITE_DATA (v_connection_handle, p_message |) UTL_TCP. CRLF);

    UTL_SMTP. WRITE_DATA (v_connection_handle, UTL_TCP. CRLF);

    I'm IN emp_cur

    LOOP

    UTL_SMTP. WRITE_DATA (v_connection_handle, i.ename |) '--' || i.SAL | UTL_TCP. CRLF);

    END LOOP;

    UTL_SMTP. WRITE_DATA (v_connection_handle, UTL_TCP. CRLF);

    -E-mail nearby

    UTL_SMTP. WRITE_DATA (v_connection_handle, '-' |) "JOHAN. SECBOUND' | '--' || UTL_TCP. CRLF);

    UTL_SMTP. WRITE_DATA (v_connection_handle, UTL_TCP. CRLF. '.' || UTL_TCP. CRLF);

    UTL_SMTP. CLOSE_DATA (v_connection_handle);

    UTL_SMTP. Quit (v_connection_handle);

    EXCEPTION

    WHILE OTHERS THEN

    UTL_SMTP. Quit (v_connection_handle);

    LIFT;

    END;

    /

    CREATE OR REPLACE SYNONYM PUBLIC PR_SEND_EMAIL OF BDA. PR_SEND_EMAIL;

    BEGIN

    BDA. PR_SEND_EMAIL (p_from_email_address => ' [email protected]')

    , p_to_email_address => ' [email protected]'

    , p_smtp_host-online 'x.xxx.xxx.xxx '.

    p_subject-online "TEST Your Mail"

    p_message-online "Is the TEST mail with the help of UTL_SMTP"

    );

    EXCEPTION, THEN THAN OTHERS

    THEN DBMS_OUTPUT. Put_line ('ERROR in the procedure PR_SEND_EMAIL-' |) SQLERRM);

    LIFT;

    END;

    /

  • Anonymous blocks that goes down and creates a table

    Version: 11.2.0.3

    I'm relatively new to PL/SQL.

    We have a table named CHK_CNFG_DTL.

    I want to create a backup table for CHK_CNFG_DTL who will be named as CHK_CNFG_DTL_BKP_ < timestamp > for example: CHK_CNFG_DTL_BKP_JULY_22_2013

    Creating this backup table must be automated, so I want to create an anonymous block that will first remove the existing backup table and then create a new backup of the original table.

    The code below works fine. But the first time when you run it, the loop will not iterate because there is no such table named % CHK_CNFG_DTL_BKP.

    declare

    v_stmt varchar2 (1000);

    date of T_DATE;

    Start

    for rec in

    (select * from user_tables where table_name like '% CHK_CNFG_DTL_BKP')

    loop

    Start

    run immediately "alter session set nls_date_format =" DD_MON_YYYY "';"

    v_stmt: = 'drop table' | Rec.table_name | "purge."

    dbms_output.put_line (v_stmt);   -Old backup drops table

    immediately run v_stmt;

    Select sysdate in double T_DATE;

    v_stmt: = "create table CHK_CNFG_DTL_BKP_ | TO_DATE (V_DATE): ' in select * from CHK_CNFG_DTL';

    dbms_output.put_line ('Bkp création table CHK_CNFG_DTL_BKP_' | to_date (v_date));

    dbms_output.put_line (v_stmt);

    immediately run v_stmt;  -Creates the new table of backup

    exception

    while others

    then

    dbms_output. Put_line (rec.table_name |'-'|) SQLERRM);

    end;

    end loop;

    end;

    /

    PL/SQL procedure successfully completed.

    -Backup table was not created.

    SQL > select table_name from user_Tables where table_name like '% CHK_CNFG_DTL ';

    TABLE-NAME

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

    CHK_CNFG_DTL

    Of course, this can fixed by creating a table as bleow before running the anonymous block

    SQL > create table CHK_CNFG_DTL_BKP_JULY_22_2013 (x varchar2 (37));

    Table created.

    and now the block will be executed with success as

    24 end;

    25.

    drop table CHK_CNFG_DTL_BKP_JULY_22_2013 purge

    Creating table Bkp CHK_CNFG_DTL_BKP_22_JUL_2013

    create the table CHK_CNFG_DTL_BKP_22_JUL_2013 select * from CHK_CNFG_DTL

    PL/SQL procedure successfully completed.

    But it goes to production. We cannot have a table like CHK_CNFG_DTL_BKP_JULY_22_2013 without an appropriate reason.

    How can I change the code above so that if even if there is no such like '% CHK_CNFG_DTL_BKP' table, he will create the backup table?

    Hello

    Why don't you press the create backup of the loop?

    declare

    v_stmt varchar2 (1000);

    date of T_DATE;

    Start

    for rec in

    (select * from user_tables where table_name like 'CHK_CNFG_DTL_BKP %')

    loop

    Start

    run immediately "alter session set nls_date_format =" DD_MON_YYYY "';"

    v_stmt: = 'drop table' | Rec.table_name | "purge."

    dbms_output.put_line (v_stmt);   -Old backup drops table

    immediately run v_stmt;

    exception

    while others

    then

    dbms_output. Put_line (rec.table_name |'-'|) SQLERRM);

    end;

    end loop;

    Select sysdate in double T_DATE;

    v_stmt: = "create table CHK_CNFG_DTL_BKP_ | TO_DATE (V_DATE): ' in select * from CHK_CNFG_DTL';

    dbms_output.put_line ('Bkp création table CHK_CNFG_DTL_BKP_' | to_date (v_date));

    dbms_output.put_line (v_stmt);

    immediately run v_stmt;  -Creates the new table of backup

    end;

  • anonymous block procedure.

    Hi experts,

    If I wrote the procedure and the means of functions and tables

    I use able to recover. USER_TABLES, such user_functions, user_objects. Ok

    Only once if I wrote an anonymous block of procedure. »

    How I see it. is there a way to drop that...

    is this possible?

    Oracle db10g

    Sorry for the delay of edition.

    ADF 7 wrote:

    If I wrote the procedure and the means of functions and tables
    I use able to recover. USER_TABLES, such user_functions, user_objects. Ok
    Only once if I wrote an anonymous block of procedure. »
    How I see it. is there a way to drop that...

    There are 2 types of units of PL/SQL code.

    Named units of PL/SQL. Here are the packages, procedures and functions. They are named. They are stored within the database. They are compiled. The compiled version is also stored in the database.

    Units of PL/SQL without name. They are anonymous PL/SQL blocks. These are created by the client. They have no name. They cannot be procedures, functions or packages. They may contain a function or procedure localized nested. They went through the Oracle client. Oracle creates a cursor by analyzing the block and then running the cursor. Client bind variables are supported in the anonymous PL/SQL block.

    Unnamed (anonymous) PL/SQL is used by customers to call units named PL/SQL.

    Named units generally contains business and the processing logic and validation - providing an interface for the client to the logical database in Oracle.

    As nameless units exist only as sliders in the memory of the server (LMS), these impossible to remove, because there is no static database object to drop.

  • Anonymous block

    What is anonymous block, what is the usefulness of this, when he'll create...

    One of them please send me the link.

    Hello

    An anonymous block with the keyword 'start' stats and ends with the "end" keyword

    It store all of the commands you want this block to do.

    Whenver required, you can then run this code to perform the same tasks over and over again.

    But the preferred method is to use the functions and procedures stored in memory and runs faster.

    For more details and information, please see:

    http://www.orafaq.com/wiki/Anonymous_block

    Procedures and functions:

    http://www.techonthenet.com/Oracle/procedures.php

    HTH
    KK

  • pl/sql-anonymous block filled

    Hello
    I have executed this PL/SQL block without errors, but I don't see that the result .i can see anonymous block realized as a result.
    I use SQL Developer...
    Help, please

    Set serveroutput on
    declare
    form constant char (20): = "square";
    real (6) region;
    side constant number (6): = 2;
    PI constant number (4,2): = 3.14;
    constant number of RADIUS (5): = 2;
    Len number constant (5): = 3;
    constant number of width (5): = 3;
    Start
    case
    What = "square" shape then area: = side * side;
    shape = "circle".
    then
    Start
    area: pi = *(radius*radius);
    dbms_output.put_line (' the area of the circle is :'|| area);
    end;
    what form = "reactangle."
    then the area: = len * width;
    on the other
    Start
    dbms_output.put_line (' not correct form ": form");
    raise program_error;
    end;
    end case;
    commit;
    end;
    /


    Thank you

    to_learn wrote:
    Hello
    I have executed this PL/SQL block without errors, but I don't see that the result .i can see anonymous block realized as a result.
    I use SQL Developer...

    displayed code performs as programmed.

    Nothing Is displayed for the 'square '!

  • Scheduling of the anonymous blocks

    Is it possible to predict an anonymous block? If so, how can I do it? a code example is appreciated.

    Edited by: jdude on October 20, 2011 04:34

    This is an example of stored procedure, I can't understand how to write one for an anonymous block

    Start
    dbms_scheduler.create_job
    (job_name = > ' SCOTT.) RUN_SCOTTS_PROC',.
    job_type = > 'procedure_stockee ',.
    job_action = > ' SCOTT. SCOTTS_PROC',.
    start_date = > trunc (sysdate + 1) + 1/24.
    repeat_interval = > ' FREQ = DAILY; BYDAY IS MON, MAR, SEA, GAME, FRI, SAT.; BYHOUR = 1;',
    enabled = > true,
    auto_drop = > false,
    Comments = > 'convert 152152 work');
    end;

    Edited by: jdude on October 20, 2011 04:42

    If you have single quotes in your anonymous block you have to do a single quote 2 x or use the q rating.
    Otherwise, the first apostrophe in the plsql block ends the string of the parameter program_action isn't?

  • Source code / application of fiction

    Hello

    This tool is fantastic and saves me a lot of time, helping us find some interesting bugs (as why 'delete myarr.pop ()' was seen such a strange side effect when the table contained channels...).

    I'm trying to get my hands on the source code for this but my clients cannot connect SVN, I tried a lot of different configurations (work, home connections and mobile) network and HTTP connections both SVN, so I think the question is about the end of Adobe/SoureForge. Can anyone check/fix this?

    The reason for wanting the source is to add a minor change the viewer Tag / Tag Information out. Currently I'm working on what the function is defined at offset 0x348B2 of my SWF file. I see in the hex editor, but it is difficult to establish what is the name of this function: the class is defined in offset DoInitActions 200492 and length 24355 i.e. a large class.

    My hope is to add offsets in each row in the DoInitActions 'Information Tag' Panel, so e.g. instead of:

    If L63

    push $1

    Press "isMouseDown.

    getMember

    pushDuplicate

    I see you:

    1522: If L63

    1527: push $1

    1527: push "isMouseDown.

    1534: getMember

    1535: pushDuplicate

    etc., where the number at the start is the offset of this directive within the DoInitActions tag.

    If anyone with the source can do this and updated the binaries then great but I suspect it's something I have to do it myself... but currently, I can't source without having to individually, find and download all files :-(

    Thank you

    Andrew

    A new version of SWF investigator came out Friday (version 0.6.2) and I will update the repository of open source in the next day or two.  When the update is finished, I'll reply to this topic so that you know to pull down the latest version of the source code.

    For SVN access, I used TortoiseSVN on Windows that is supported by SourceForge: http://sourceforge.net/apps/trac/sourceforge/wiki/TortoiseSVN%20instructions

    The logic for your feature request already exists in investigator SWF but it is currently made in comment. For the next version, I can work on enabling it. If you want to play with the feature in the interval, then the code is in SWFInvestigator/src/decompiler/tools/Disassembler.as.Within this file, there is a function called, 'start '. In this function, there is an if block that checks the "showOffset. You will need to uncomment the out.print () statement in the if-block showOffset. You can set showOffset to true just before the if statement. Recompile the application and it will start to display the information you want.

  • Passage of the Arguments to the anonymous block

    I have a unix script that calls an anonymous block / sql file.
    The sql file read a flat file via UTL_FILE utility and insert/update to update these data to the table.
    When calling SQL script, I put
     'SET DEFINE OFF' 
    to get rid of the * '&' * char in the string (input file).
    Now I have to deal with several files on the same trial, I invoke the SQL script from arguments like:

    Invoke:
    start xx.sql FILE_NAME
    Inside to access the xx.sql arguments like:
    declare
    y varchar2(20);
    begin
    dbms_output.put_line('Y= '||y);
    y:='&1';
    dbms_output.put_line('Y= '||y);
    end;
    /
    It only works if I put
     'SET DEFINE ON' 
    In this case no * '&' * char being treated as read from the standard input.
    Create procedure/function is out of reach.
    Someone can suggest... that should be the approach and is there a way to manage it?

    Hello

    Linda wrote:
    I have a unix script that calls an anonymous block / sql file.
    The sql file read a flat file via UTL_FILE utility and insert/update to update these data to the table.
    When calling SQL script, I put

     'SET DEFINE OFF' 
    

    to get rid of the * '&' * char in the string (input file).

    Are your really get into single quotes? If this is not the case, why you put them in this message?

    Now I have to deal with several files on the same trial, I invoke the SQL script from arguments like:

    Invoke:

    start xx.sql FILE_NAME
    

    Who is using SQL * more variable substitution. You must SET SET to retrieve the value of a variable substitution.
    You do not have to use & to mark the substitution variables; If you know iof some other special characters (such as ~) which is not used in your code, you can do the marker by saying:

    SET     DEFINE  ~
    

    Moreover, if the variable represents a value of sclar (wuch as the string "Filename" in your example), you can use bind variables to pass data in your anonymous block.
    For example, at the beginning of xx.sql, you can declare and set a varibale bind like this:

    VARIABLE     arg_1     VARCHAR2 (20);
    
    SET     DEFINE     ON
    
    EXEC :arg_1 := '&1';
    
    SET     DEFINE     OFF
    

    DEFINE must be enabled only for the statement that sets: arg_1.
    After that, your script can use: arg_1 instead of & 1:

    declare
        y varchar2(20);
    begin
        dbms_output.put_line('Y= '||y);
        y:=:arg_1;
        dbms_output.put_line('Y= '||y);
    end;
    /
    

    Note that you do not quote the variable name to bind when it is used. You had to mention the name of substitution variable, because SQL * Plus solves the substitution variables before sending the code for the compiler, but SQL * more passes the variable binding for the compiler, and the compiler can see that: arg_1 is a VARCHAR2.

    You can also define and set the binding variable in the calling script, but the passage of an argument tends to be a better way.

    There are other alternatives (such as escape &s);) We can Explorer if the two methods I described above do not work for you.

  • Transition from Unix to an anonymous block variable

    Hello..

    Any1 can tell me how to pass a variable to a Pl Sql anonymous block unix
    var1 = "grep"a"$cmdfile |" nawk f «;» '{print $2} ' | TR-s ' ' | cut-d ""-f2 "
    var2 = "grep"b"$cmdfile |" nawk f «;» '{print $3} ' | TR-s ' ' | cut-d ""-f2 "

    So when I write an anonymous block how to pass these values var1 and var2?
    Thanks in advance

    I don't know how would be an anonymous block will be useful for any application. We generally use stored procedures and for this case, we have used to refer to the unix variable as below.

    execute stored_proc_name unixvar1 unixvar2
    

    and in the code

    create or replace procedure stored_proc_name... ...
    begin
    unixvar1:=&1;
    unixvar2:=&2;
    end;
    

    I hope this helps.

  • help for anonymous block

    Hi friends
    I am developing anonymous blocks that displays the message on the screen, like "hello world" "is SYSDATE today" and "tomorrow is SYSDATE + 1". To make me try to develop anonymous block, but it shows me error... so friends can you help me with this...

    Set SERVEROUTPUT on
    declare
    p_text varchar2 DEFAULT "hello world";
    P_date date default sysdate;
    P_next_date date default sysdate + 1;
    Start
    DBMS_OUTPUT. PUT_LINE (|) P_text);
    DBMS_OUTPUT. Put_line (' today's :'||) P_date);
    DBMS_OUTPUT. Put_line ("tomorrow is :'|| p_next_date);
    end;
    /


    Thanks in advance
    Rommy

    Hi, Rommy,

    Always format your code. Dash to show the main sections (DECLARED, BÉGIN, etc..)
    Type these 6 characters
    {code}
    (small letters only, inside curly braces) before and after the formatted text, to keep the spacing when posting on this site.

    DECLARE
         p_text          VARCHAR2 (50)  DEFAULT 'hello world';
         P_date          DATE            DEFAULT SYSDATE;
         P_next_date     DATE            DEFAULT SYSDATE + 1;
    BEGIN
         DBMS_OUTPUT.PUT_LINE (P_text);
         DBMS_OUTPUT.PUT_LINE ('today is: ' || TO_CHAR (P_date, 'Dy DD-Mon-YYYY'));
         DBMS_OUTPUT.PUT_LINE ('Tommorrow is: ' || TO_CHAR (p_next_date, 'Dy DD-Mon-YYYY'));
    END;
    /
    

    When you declare a VARCHAR2 variable, you must specify the maximum length.

    The | operator is used between two string expressions; Looks like you forgot the first operand in one place.

    Using a DATE where we expect a VARCHAR2 (as an operand to |, for example) is not technically an error, but it's a bad habit. TO_CHAR to create a string in any format you want.

  • Firefox 41.0.2 long lines don't wrap when you view the source code

    When I try to view the source code of a web page, I have to use horizontal scrolling. How can I make the text as it does on my IE6?

    If necessary, you can change the setting in this way as well:

    (1) in a new tab, type or paste Subject: config in the address bar and press enter/return. Click on the button promising to be careful.

    (2) in the search above the list box, type or paste wrap it up and make a pause so that the list is filtered

    (3) double-click the preference view_source.wrap_long_lines to switch the value from false to true

  • I want to take the source code of each Web page as input and address on it, how can I do this?

    I'll develop an add-on for mozilla firefox, but for this I need the source code for each page. This is necessary to find the tag button inside the source code, to search for the tag href in the source code, etc... So please help me for this.

    The forum of the add-on is here:
    https://forums.addons.Mozilla.org/

  • How do you define an external display of HTML source code?

    I want to stop using FireFox built in HTML source code viewer and use an external viewer. Tools | Options provides no way to do this. Poking around the subject: config doesn't reveal anything either.

    Surely this question has been asked and answered a million times already, but when I try to look for it on the web page of Mozilla support I earn millions of hits of garbage on PDF files - and I can't find a way to do an advanced search that excludes the word "PDF". Even the obvious assumption to put "-pdf" in the search field does not work. Even more mind-boggling: If you search for "advanced search mozilla support" comes only garbage - nothing on how to do an advanced search.

    You can watch these prefs to use an external viewer.

Maybe you are looking for

  • At 2 this morning toolbars; now don't have only one. How to restore the missing toolbar?

    Not very in computing, so here: this morning, I had 2 toolbars or a toolbar of level 2 showing the icons and descriptive captions, I created some time ago. I was the computer off for awhile and when I came back to it only the first toolbar (or level)

  • Question of equipment for a Satellite L500-1UR

    First... Sorry for my English. My neighbor bring me an a L500-1UR that he redeemed with default. Broken Panel, without HDD, RAM, optical-LW No. If I can change the TFT and and and? What he & I didn't know: there is no fan in the case. Before I go to

  • Skype video Crash Windows 8.1

    Whenever I try to access the video with Skype, it blocks my Dell coming 8 Pro running Windows 8.1. I tried to uninstall and install an older version of Skype. I've updated all my drivers Intel and Dell. I reinstalled the latest version of Skype. The

  • Windows 10 no network or wifi connections

    Lenovo X 1 carbon - after the upgrade to windows 10 I can't network connectivity, even if the devices are listed in the Device Manager. Under change map settings, it is empty Thank you EDICT of 30/07/15: line editing of the object in order to improve

  • free fall detection

    Hello I want to add a free fall detection to my prototype using myDAQ and LabVIEW. I need to come out with a program. How to make using the screws and what type of fall detection sensor/hardware do I need? I am a student and a low-cost project.  As I