Cannot run PL/SQL using SQL * more

Hello

I am very new in the SQL environment. I want to run the following PL/SQL code, which should allow me to send an e-mail, using sql * more:

DECLARE
l_mailhost VARCHAR2 (64): = "qiudubcorrel001.qa.local";
l_from VARCHAR2 (64): = "[email protected]";
l_to VARCHAR2 (64): = "[email protected]";
l_mail_conn UTL_SMTP.connection;
BEGIN
l_mail_conn: = UTL_SMTP.open_connection (('10.253.14.240'), 25);
UTL_SMTP. HELO (l_mail_conn, '10.253.14.240');
UTL_SMTP.mail (l_mail_conn, l_from);
UTL_SMTP. RCPT (l_mail_conn, l_to);
UTL_SMTP. Data (l_mail_conn, 'single string message.' |) Chr (13));
UTL_SMTP. Quit (l_mail_conn);
END;

When I type the code above in sql * Plus, it does nothing but waiting just as if the code is incomplete and he expects something more! Could someone tell me what is the problem here?

Thank you
Kamal

Hello

Try to put a / on a new line after END;

Concerning
Peter

Tags: Database

Similar Questions

  • Same code running in SQL * more edit the sql buffer vs = different results file

    Hello

    For the last few minutes I was scratching my head trying to understand why my little piece of code was not working.
    As a result, a sample:
    create or replace type booktitles_nt is TABLE OF VARCHAR2(100);
    /
    declare
      booklist booktitles_nt := booktitles_nt('Great Expectations','Ulysses','1984');  
    begin
      for i in booklist.FIRST .. booklist.LAST LOOP
        dbms_output.put_line('Book number ' || i || ':' || booklist(i));
      end loop;
    end;
    /
    When run interactively, I get the following results:
      1  create or replace type booktitles_nt is TABLE OF VARCHAR2(100);
      2  /
      3  declare
      4    booklist booktitles_nt := booktitles_nt('Great Expectations','Ulysses','1984');
      5  begin
      6    for i in booklist.FIRST .. booklist.LAST LOOP
      7      dbms_output.put_line('Book number ' || i || ':' || booklist(i));
      8    end loop;
      9* end;
    SCOTT@ORCL> /
    
    Warning: Type created with compilation errors.
    
    SCOTT@ORCL> show errors
    Errors for TYPE BOOKTITLES_NT:
    
    LINE/COL ERROR
    -------- -----------------------------------------------------------------
    2/1      PLS-00103: Encountered the symbol "/"
    So I try without the slash and get nowhere:
      1  create or replace type booktitles_nt is TABLE OF VARCHAR2(100);
      2  declare
      3    booklist booktitles_nt := booktitles_nt('Great Expectations','Ulysses','1984');
      4  begin
      5    for i in booklist.FIRST .. booklist.LAST LOOP
      6      dbms_output.put_line('Book number ' || i || ':' || booklist(i));
      7    end loop;
      8* end;
      9  /
    
    Warning: Type created with compilation errors.
    
    SCOTT@ORCL> show errors
    Errors for TYPE BOOKTITLES_NT:
    
    LINE/COL ERROR
    -------- -----------------------------------------------------------------
    2/1      PLS-00103: Encountered the symbol "DECLARE"
    8/4      PLS-00103: Encountered the symbol "end-of-file" when expecting
             one of the following:
             ( begin case declare end exception exit for goto if loop mod
             null pragma raise return select update while with
             <an identifier> <a double-quoted delimited-identifier>
             <a bind variable> << continue close current delete fetch lock
             insert open rollback savepoint set sql execute commit forall
             merge pipe purge
    So I think, maybe I'll try it in a .sql file. So I put the first fragment of code in a file, test4.sql:
    SCOTT@ORCL> get C:\Users\J\Documents\SQL\test4.sql
      1  create or replace type booktitles_nt is TABLE OF VARCHAR2(100);
      2  /
      3  declare
      4    booklist booktitles_nt := booktitles_nt('Great Expectations','Ulysses','1984');
      5  begin
      6    for i in booklist.FIRST .. booklist.LAST LOOP
      7      dbms_output.put_line('Book number ' || i || ':' || booklist(i));
      8    end loop;
      9* end;
    SCOTT@ORCL>
    and run it, and it works:
    SCOTT@ORCL> @C:\Users\J\Documents\SQL\test4.sql
    
    Type created.
    
    Book number 1:Great Expectations
    Book number 2:Ulysses
    Book number 3:1984
    
    PL/SQL procedure successfully completed.
    Can someone tell me why the behavior is different when it is run from a file when it is run, well, interactive? There seems to be some limits on what you can interactively run vs. what you can run from a script.

    Thank you very much
    Jason

    SQL * more buffer cannot contain more than one return, even if you have two - create type and anonymous PL/SQL block. Thus it-error:

    Wrote file afiedt.buf
    
      1  create or replace type booktitles_nt is TABLE OF VARCHAR2(100);
      2  /
      3  declare
      4    booklist booktitles_nt := booktitles_nt('Great Expectations','Ulysses','1984');
      5  begin
      6    for i in booklist.FIRST .. booklist.LAST LOOP
      7      dbms_output.put_line('Book number ' || i || ':' || booklist(i));
      8    end loop;
      9* end;
    SQL> /
    
    Warning: Type created with compilation errors.
    
    SQL> create or replace type booktitles_nt is TABLE OF VARCHAR2(100);
      2  /
    
    Type created.
    
    SQL> declare
      2    booklist booktitles_nt := booktitles_nt('Great Expectations','Ulysses','1984');
      3  begin
      4    for i in booklist.FIRST .. booklist.LAST LOOP
      5      dbms_output.put_line('Book number ' || i || ':' || booklist(i));
      6    end loop;
      7  end;
      8  /
    Book number 1:Great Expectations
    Book number 2:Ulysses
    Book number 3:1984
    
    PL/SQL procedure successfully completed.
    
    SQL>
    

    SY.

  • Error messgae: "the screen saver cannot run because it requires a more recent video card", attempting to display the screen saver and the error code 40 download the fix.

    Original title: cannot run zip; error code 40 (hotfix for the video card)

    Hi, I ' m trying to view my screen saver and it seems to be causing "the screen saver can't run because it requires a newer video card or compatible with 3d graphics." (2030 M-windows7 dell) .thanks Jean-Michel

    Hi John,.

    1. what screen saver are you trying to view?

    2 is confined to a specific screen saver?

    3. have you installed SP1 for Windows 7?

    This problem occurs because of a problem in 3D screensavers.

    Fix error occurs if you have a corrupt hotfix package or may have downloaded the wrong patch for your platform.

    This can also occur if the hotfix is included in SP1 and you have already installed Windows 7 SP1.

    Method 1:

    You must make sure that the hotfix you download is depending on the version of Windows 7 installed on your computer.

    For more information, see the article:

    Error message when you set a 3D screen saver screen saver in Windows 7 or in Windows Server 2008 R2: "the screen saver can't run because it requires a more recent or Direct3D-compatible video card.

    Please see if you can copy the file that you downloaded to another computer or location and try to unpack.

    When you download the fix, save it in a new location (on the desktop) and the password given with the fix allows to extract the file.

    Method 2:

    Step 1:

    You can also try to run the display quality Troubleshooter and check if it helps.

    Step 2:

    You too, try to install the latest version of the Site Web of Dell display drivers and check if it helps.

    Hope the helps of information. Let us know if you need help with Windows related issues. We will be happy to help you.

  • Cannot run Windows Explorer using the interactive services detection

    Hello

    I have the tool using the interactive services detection to display applications. I have to refrain from using the Terminal Server services for the moment and the DSI is the only option I have. Now the problem is, this tool must run Windows explore periodically as well as other applications Viz Notepad, wordpad. It shows notepad and wordpad but always fails to open windows Explorer. Any ideas on that?
    PS: everything what I described above works great with the Terminal Services
    Thank you
    Madhu

    Hi Madhu,

    The question you posted would be better suited for COMPUTING public Pro on TechNet. I would recommend posting your query in the TechNet Forums to get help:

    Windows 7 security TechNet Forums

    Let us know if you need help with Windows related issues. We will be happy to help you.

  • Cannot run business ruleset using the Launcher command line for the calculation Manager

    Hello

    I use the Hyperion 11.1.2.2 planning version. I am trying to execute a business rule defined via the calc Manager command line utility. Please see the order form below,

    D:\Oracle\Middleware\user_projects\epmsystem1\Planning\planning1 > CalcMgrCmdLineLauncher.cmd /U:HBRadmin D:Capex /A:CORP S:Capex_Nightly

    At the launch of the above command, the utility starts and ends without triggering the rule in the database. See log info below,

    Local planning: en_US

    using java.library.path: D:\Oracle\Middleware\EPMSystem11R1/products/Planning/lib64

    EPM_ORACLE_HOME (D:\Oracle\Middleware\EPMSystem11R1) has the value of the property 'EPM_ORACLE_HOME' of the JVM.

    using the property of Java for Hyperion home D:\Oracle\Middleware\EPMSystem11R1

    For the non - RFP app, ask size is not necessary

    EPM_ORACLE_INSTANCE (D:\oracle\Middleware\user_projects\epmsystem1) has the value of the [EPM_ORACLE_INSTANCE] property of the JVM.

    Support RTC Essbase Version: 0xb1221

    null

    But if I try to execute a business rule with the calc Manager command-line utility, it works well. It is only rules base which poses problem. Please note that this set of rules is to have business rules that belong to a database that is Capex.

    Any help on this request would be much appreciated. Please notify.

    Thank you

    AP

    Please ignore this request,

    I found the KB article below

    Hyperion Planning Rulesets cannot be launched using the CalcMgrCmdLineLauncher planning (Doc ID 1453630.1)

    Thank you

    Arun

  • Cannot run CS6 after using the CC (CC subscription has expired)

    I let my subscription CC expire (while my company treats a new license) and to do in the meantime to CS6. However, I cannot go beyond the message 'Renew your membership' and can't seem to save my copy of CS6 (it will not be displayed as a registered product and I can not add). I tried to use the CleanerTool Adobe CC (as recommended here), removed all Adobe products and reinstalled CS6 (and rebooted), but still can't make it work. Any help would be greatly appreciated!

    Hi Andre, try the steps mentioned in the link below.

    Waiting for your response.

    Atul_Saini

  • Cannot run "Microsft Update" using windows 7 home premium

    I can run "Windows update" as both me and as an administrator, but I got an error "Run as Administrator" when I try to run updates for other programs (Microsoft Update).  It seems to pass to my user credintials.

    JoePila,
    Is your user name, the one on the PC?  If this is not the case, what happens when you try another connection? Post with info Amrita asked and issues I have.  I suggest creating a user profile and test the updates on this topic. Mike - Engineer Support Microsoft Answers
    Visit our Microsoft answers feedback Forum and let us know what you think.

  • Cannot run my application in debugging more

    Hi guys,.

    Since a few days, I have a problem that prevents me from my debugging application.

    When I start a debugging session, I have a popup with:

    Error in the final launch sequence
    Failed to execute the command of MI:
    -target - select qnx 169.254.0.1:8000
    The debugger back-end error message:
    169.254.0.1:8000: no such file or directory.
    169.254.0.1:8000: no such file or directory.

    Anyone know why or what I can do?

    I tried to recharge my camera, to remove and add it back in momentics, I tried wifi and usb...

    Thank you.

    EDIT: I forgot to say that I am Momentics IDE under Windows (10). On my machine virtual Debian8 debug mode works very well.

    In this case, to remove the project and try to re - import.  You could try to import a fresh workspace too in case that something has changed at this level.

  • Special characters could not load DB via SQL * MORE

    Hi, I have a pl as .accidentally sets sql script which will insert data in database. The question is there are some records are missing and these missing records contains a special character: Sansao and Strasse. The strange was if I run the script via F5 (Toad), all data can be inserted successfully but run through SQL * MORE (Toad), all records that contain special characters are not inserted.

    Anyone here know why it didn't load these special characters via SQL * MORE?

    Probably because you have given unicode (multi byte charsets) you read with a customer of standard single-byte character set.

    It's SILLY to loading data using SQL * more. It's the wrong tool used for loading the data. It does not support the bind variable. It doesn't support liaison in bulk. It does not support direct path inserts. It is not SQL * Loader.

  • SQL * more report: hide accept the value in the report

    Hi all

    I created a SQL for APEX-Application report. The output is stored in an HTML file.

    Everything works great but think I want to hide in the HTML report.

    I try to describe what is the problem.

    I invite the user to put in the demand of the apex application_id:

    accept v_application_Id char prompt ' ID application:'

    In the HTML file, you receive the following output:

    Report tabled the:
    June 25, 2013, 10:06:04

    ALT 8: where application_id = & & v_application_id
    Neu 8: where application_id = 680

    Workspace
    Workspace APPLICATION_ID Application_name ALIAS OWNER
    Q0Q0AUFTRAGSVERWALTUNG680Q0Q0AUFTRAGSVERWALTUNGF680317Q0Q0AUFTRAGSVERWALTUNG_ADMIN

    How to hide the two lines

    ALT 8: where application_id = & & v_application_id

    Neu 8: where application_id = 680

    According to the report?

    I searched this forum and toke a glance in the documentation, but I found nothing.

    Could someone help me please?

    Oracle 11g R2

    This is the SQL script I run in SQL * more.


    -launch script

    accept v_application_Id char prompt ' ID application:'

    coil C:\a\APEX.html


    termout off Set
    SET of HTML MARKUP WE REEL WE HEAD ' < TITLE > SQL * more APEX report < /title >--
    "< STYLE TYPE =" TEXT/CSS"> <!-BODY {bgcolor: background ffffaa: ffffc6}-> < / STYLE >.
    Clear jump
    clear the buffer
    Claire calculate
    clear the column
    Disable the sql
    Set feedback off
    Set serveroutput on


    --
    -Report header
    --
    TTITLE left ' ' jump 1
    Select TO_CHAR (sysdate, 'dd-Mon-yyyy, hh24:mm:ss') ' report created on:
    Double;


    --
    -Workspace
    --
    TTITLE left col 15 ' < police = "Arial" size = "+ 2" color = "#0000FF" > workspace < / police > ' jump 1

    set linesize 300
    set pagesize 500
    Set serveroutput on


    column format a35 workspace
    application_id 99999999 column format
    column format a35 application_name
    column alias format a35
    column owner format a35

    Select

    WORKSPACE,
    APPLICATION_ID,
    APPLICATION NAME,
    ALIAS,
    OWNER
    of apex_applications
    where application_id = & & v_application_id;

    off Ttitle

    Select
    APPLICATION_GROUP,
    APPLICATION_GROUP_ID,
    HOME_LINK,
    PAGE_TEMPLATE,
    ERROR_PAGE_TEMPLATE
    of apex_applications
    where application_id = & & v_application_id;


    Set termout on
    moved the markup html off the coast of the "body" entmap wide head reel off pre
    Set of feedback on
    set linesize 80
    set pagesize 50
    off Ttitle
    Set termout on
    Set serveroutput off
    spool off
    set echo on

    -End Script


    Best regards

    Ben

    Oracle 11g R2

    Hi, Ben.

    The SQL * Plus command to stop these messages is

    SET VERIFY OFF

    Put this command anywhere before the first use of a substitution variable, for example before the order of the COIL.

    These 'OLD' and 'NEW' messages will remain deleted until you finish the SQL * most the session or cause a SET VERIFY ON command.

    If you use SQL * more often, then, when you have a few minutes, look for the SET command in SQL * more manual,.

    System of SETTING Variable summary

    and read a little about each option.  You probably don't remember everything, but you'll probably remember what kind of things can be controlled by the SET command and get a better idea of where to start to look in the future when you have a different problem.

  • SQL with parameter in SQL more value

    Hi the master Oracle,


    I have a request as described below that you run on SQL more.


    Select object_name, object_type from USER_OBJECTS WHERE last_ddl_time between trunc (sysdate)-1 and sysdate;


    I tried this script to be set, when I run it then SQL should ask two values.
    If I do not give any value then script should use by default as SYSDATE.

    Someone could please let me know how to do this?



    Kind regards
    Sandeep Sutar
    select object_name
          ,object_type
      from user_objects
    where trunc(last_ddl_time) between trunc(to_date(nvl(&1,sysdate))) -1 and to_date(nvl(&2,sysdate))
    
  • trying to get used to sql * more running and creating a simple procedure

    Hello all;

    I'm getting used to sql * more after using for a while using pl/sql developer.

    I am trying to create a simple procedure and run it. See my procedure below
    create or replace procedure test(t in varchar2(200), limit in number(30))
    begin
    select tbl_report.id from tbl_report where tbl_report.id like '|| t ||%' and rownum <= limit;
    end test;
    and then I type in run hr.test ("J", 10); to run this and then press ENTER, and it does nothing. How can I run and create a simple procedure in sql * more

    Hello

    In addition to all the good points, others have done:

    When you issue a SELECT statement in SQL * Plus (or any other front end) two things happen:
    (1) a result set, containing the results of your query, is produced, and
    (2) this result set is displayed.
    Given that these two things are always done together, it is easy to forget that they are two different things.
    In PL/SQL, you must explicitly do something to catch the result set, and you must explicitly do something else to view it (if you want to display it).

    A simple way to get the result set is to use a cursor FOR loop, to extract a line at a time and run code with this line in a record variable (called the country in the example below).
    View the results is to call dbms_output.put_line.

    Here is an example:

    CREATE OR REPLACE PROCEDURE     test
    (       t       IN      VARCHAR2
    ,     lmt      IN     NUMBER          -- LIMIT is an Oracle keyword; best not to use it as a variable name
    )
    IS
    BEGIN
        FOR  country  IN ( SELECT  country_name
                          FROM    hr.countries
                     WHERE   country_name     LIKE t || '%'
                     AND     ROWNUM          <= lmt
                   )
        LOOP
            dbms_output.put_line (  country.country_name
                        || ' = country_name'
                        );
        END LOOP;
    END test;
    /
    SHOW ERRORS
    

    You can use variables, such as t and lmt, in the query without using dynamic SQL, as long as the variables do not have the same names as the columns in the table. In this case, t and lmt are good names; country_name or region_id wouldn't. (In fact, t is a reputable insofar as it cannot be confused with a column in the table of the country. T is not a good reputation in the sense that it does not give much information about what contains the variable, or how it is used. Why not call the variable target_name or name_a_trouver?

    You can run the SQL procedure * more like this:

    SET     SERVEROUTPUT     ON
    
    EXEC  test ('I', 2);
    

    If you issue the SET SERVEROUTPUT ON command, then you will not see the output of dbms_output. You must only issue the command SET SERVEROUTPUT ON once per session, but nothing bad happens if you do it more than once.

    When I ran the procedure as stated above, I got this output:

    Israel = country_name
    India = country_name
    

    Notice that "The Italy" does not appear, because lmt has 2.

    Do not create your own procedures, tables or other objects in the HR schema, or among all the other patterns created by Oracle. Create your own schema and create procedures and other objects in it.

  • bad connect to Sql * more via command and cannot log on to the designer (need for connection string)

    I installed Oracle Developer with success, but having bad connect to Sql more than command line, also unable to connect via the developer tools, I get a TNS: Connect timeout occurred. This happens also for the "Plus" Sql for Windows.

    Oracle Forms connect error.png


    However, I can connect via the Sql Plus command window when it is executed from "Start-> all programs", but not when I first run the command window:

    sqlplus error.PNG


    I have a good Oracle 11 g install on Windows 7 and a good developer Sql install so I can connect to databases, but something does not work when you try to connect through these tools. Although Sql Plus works when called from 'Start-> all programs'

    sqlplus scott/tiger - don't use SQL * Net, you can connect like this even with the listener is stopped.

    Developer SQL can ONLY connect using SQL * Net & can be blocked by the firewall

    to connect using sqlplus & SQL * Net, you need to invoke it as below

    sqlplus scott/tiger@orcl

  • Connect to the database with SQL * more: is TNSNAMES. ORA used?

    Hello

    We have a local database called DEV01 and a copy of this database in a data center. To be able to connect to both databases, the TNSNAMES file. ORA

    on the local database server (not the one in the data center) has the following entries:

    / * Entry for the local database * /.

    DEV01_local, DEV01_local. WORLD =
    (DESCRIPTION =
    (ADDRESS_LIST =
    (ADDRESS = (PROTOCOL = TCP)(HOST = server01) (PORT = 1521))
    )
    (CONNECT_DATA =
    (SERVER = DEDICATED)
    (SID = DEV01)
    )
    )

    / * Entry for the database in the data center * /.

    DEV01, DEV01. WORLD =
    (DESCRIPTION =
    (ADDRESS_LIST =
    (ADDRESS = (PROTOCOL = TCP)(HOST = server02) (PORT = 1521))
    )
    (CONNECT_DATA =
    (SERVER = DEDICATED)
    (SID = DEV01)
    )
    )

    When I connect to the local database server, I set the Oracle environment as follows:

    export ORACLE_SID = DEV01

    export PATH=/opt/oracle/app/oracle/product/9.2.0/bin:$PATH

    export ORACLE_HOME=/opt/oracle/app/oracle/product/9.2.0

    Now I start SQL * more as follows:

    Oracle # > sqlplus user/user

    SQL > select instance_name, host_name from v$ instance;

    INSTANCE_NAME HOST_NAME

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

    SERVER01 DEV01

    As the SID is on two databases of the same (DEV01) I really don't understand how Oracle decides which of the SQL databases * more connects to.

    Is it the entry in the TNSNAMES file. ORA?

    But when I start SQL * more as follows:

    Oracle # > sqlplus user/user@DEV01_local

    SQL > select instance_name, host_name from v$ instance;

    INSTANCE_NAME HOST_NAME

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

    SERVER01 DEV01

    or

    Oracle # > sqlplus user/user@DEV01

    SQL > select instance_name, host_name from v$ instance;

    INSTANCE_NAME HOST_NAME

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

    DEV01 server02

    everything is as expected.

    Does anyone know who is the chosen database when just to connect with 'sqlplus user/user' (without the @DEV01 or @DEV01_local)?

    Any help will be appreciated!

    Rgds

    Jan

    When you connect to the local database that is connected to the server01, you need only specify the sid in the environment, in this case, Oracle tnsnames file to connect, actually uses, it uses any of the listener.  It uses what is called a connection needed.  It is purely a side connection server, and as long as the sid is located in the environment resolves to a database running on that server, you will be get connected.

    When you connect using the @connect_descriptor, like you second case, then Oracle will use the configured naming, including tnsnames, methods to solve the 'real' database  In this case, the auditor is required to create the connection to the database.

    John

  • running sql * more

    Hello all;

    I know this question has been asked several times but I'm still a little confused. I installed oracle database 10g express edition on my computer for the practice of the school. It works fine if I go to the homepage of database icon... However, there is another icon which evokes SQL * who I am trying to use to run sql on my computer but nothing happens when I type in a simple sql statement. I was just wondering how to make sql * more correctly installed on my pc so that I can use PL/SQL instructions for the code, packages, and triggers as well.

    You must copy the entry in the tnsnames.ora file for the installation of xe, which is located in
    C:\oraclexe\app\oracle\product\11.2.0\server\network\ADMIN
    on Windows

    XE =
      (DESCRIPTION =
        (ADDRESS = (PROTOCOL = TCP)(HOST =host.xx.xxx.net)(PORT = 1521))
        (CONNECT_DATA =
          (SERVER = DEDICATED)
          (SERVICE_NAME = XE)
        )
      )
    

    and edit the tnsnames.ora file from where you are running more than SQL.

    For example, I have a client installed 10g, which has its own file tnsnames.ora but I also 11g XE installed.
    This entry must exist in the customer 10g tnsnames.ora file if I want to connect with the version of windows
    SQL Plus to Database 11g XE.

    Moreover, why don't you upgrade to 11g xe?
    http://www.Oracle.com/technetwork/database/Express-Edition/downloads/index.html

    The final version was released earlier this month.

Maybe you are looking for