Choose one in SQL Developer fails - SQL * more work

Hi all

I have the HS to MySLQ connection works correctly and most of the requirements I have in regards to the data works.


However, I "only able to test my procedures and functions in SQL * more." IN SQL Developer 4.0.0.12 there is always a problem and questioning of the results are never displayed.

Thanks in advance for any advice.

Sincerely

JS

Hello Mike,.

I use Oracle XE 11.2.0.2 x 64 on Linux. Using the MySQL ODBC 5.3.4 connection.

I've just upgraded the SQL Developer to version 4.0.3 (released September 2014) and the problem seems to be resolved because I'm able to query the MySQL database and get the results.

However, there is something I don't like all the whitespace added, whether in SQL Developer 4.0.3 in SQL * more.

Here's the query I tested:

Select "host", "User", "Password" in "user"@MYODBC5;

Tags: Database

Similar Questions

  • SQL * more the 'timing' in SQL Developer command

    I installed SQL Developer version 4.1.1.19. In the sql worksheet, how can I use SQL * more order 'timing' in a script to see a time elapsed SQL? The "Timing" on 'set' did not return any info after running SQL, and 'calendar beginning mon_timer' back 'command Timing is obsolete. Help, please.

    Thank you

    • As you can see, there is no calendar information in the script output log.
    • Then I tried on the discussion forum, found it can be enabled in "tool > preference > Database > startup script" and set as startup script:

    Set serveroutput on

    set timing on

    • However, 2 questions are:
    1. the calendar that he returned is NOT the elapsed time of my stored procedure to run. He simply choose the 2 time points its time, before and not after MS point run. Set timing on is therefore not a solution for me.
    2. He did not follow the instructions in the startup script. After that I put the calendar in the startup script, stop & restart SQL Developer, same laptop charging, timing still on. The only way to turn off now is to configure it to NOT use

    any startup script.

    • Then I developed my own coding as a solution:

    3. control of the COIL

    VAR bv_start_ts VARCHAR2 (30)

    VAR bv_end_ts VARCHAR2 (30)

    VAR bv_elps_ts VARCHAR2 (30)

    DECLARE

    v_start_ts VARCHAR2 (30);

    BEGIN

    SELECT TO_CHAR (SYSTIMESTAMP, 'yyyymmddfxDyhh24miss.ff6') INTO v_start_ts FROM DUAL;

    : bv_start_ts: = v_start_ts;

    END;

    /

    IMPRESSION bv_start_ts

    EXEC pmsmmi.rpt.rpt_ethncty_race_smry (15);

    DECLARE

    v_end_ts VARCHAR2 (30);

    BEGIN

    SELECT TO_CHAR (SYSTIMESTAMP, 'yyyymmddfxDyhh24miss.ff6') INTO v_end_ts FROM DUAL;

    : bv_end_ts: = v_end_ts;

    END;

    /

    IMPRESSION bv_end_ts

    EXEC: bv_elps_ts: = TO_CHAR (TO_TIMESTAMP (: bv_end_ts, 'yyyymmddfxDyhh24miss.ff6')-TO_TIMESTAMP (: bv_start_ts, 'yyyymmddfxDyhh24miss.ff6'), 'hh:mi:ss.ff6');

    IMPRESSION bv_elps_ts

    SPOOL OFF

    • Then I got what I want, the answer is in the 'PRINT ': bv_elps_ts

    SQL > VAR bv_start_ts VARCHAR2 (30)

    SQL > VAR bv_end_ts VARCHAR2 (30)

    SQL > VAR bv_elps_ts VARCHAR2 (30)

    SQL > DECLARE

    v_start_ts VARCHAR2 (30);

    BEGIN

    SELECT TO_CHAR (SYSTIMESTAMP, 'yyyymmddfxDyhh24miss.ff6') INTO v_start_ts FROM DUAL;

    : bv_start_ts: = v_start_ts;

    END;

    /

    PL/SQL procedure successfully completed.

    Elapsed time: 00:00:00.031

    SQL > PRINT bv_start_ts

    BV_START_TS

    -----------

    20150702Thu112617.775545

    SQL > EXEC pmsmmi.rpt.rpt_ethncty_race_smry (15)

    PL/SQL procedure successfully completed.

    SQL > DECLARE

    v_end_ts VARCHAR2 (30);

    BEGIN

    SELECT TO_CHAR (SYSTIMESTAMP, 'yyyymmddfxDyhh24miss.ff6') INTO v_end_ts FROM DUAL;

    : bv_end_ts: = v_end_ts;

    END;

    /

    PL/SQL procedure successfully completed.

    Elapsed time: 00:00:00.062

    SQL > PRINT bv_end_ts

    BV_END_TS

    ---------

    20150702Thu112630.805786

    SQL > EXEC: bv_elps_ts: = TO_CHAR (TO_TIMESTAMP (: bv_end_ts, 'yyyymmddfxDyhh24miss.ff6')-TO_TIMESTAMP (: bv_start_ts, 'yyyymmddfxDyhh24miss.ff6'), 'hh:mi:ss.ff6')

    PL/SQL procedure successfully completed.

    SQL > PRINT bv_elps_ts

    BV_ELPS_TS

    ----------

    + 00:00:13.030241000 000000

    SQL > SPOOL OFF

  • Out of the script SQL more not displaying is not operating in SQL Developer

    Hello

    I have a script el_ccn.sql with the content...

    Select count (*) in the NCC;

    When I run @el_ccn.sql in a SQL Developer the option worksheet dependencies execute the Script (F5)

    all that is displayed is

    COUNT (*)
    ----------

    When I run it in SQL, I see...

    COUNT (*)
    ----------
    2285

    1 selected line.

    I can 'open' the script and then run OK but I test it before implementing more complex SQL script files, so would like to know if this is possible with SQL Developer. A colleague does not have access to SQL over, so I need to check they can do this with SQL Developer before you start a COMPUTER call helps bring sqlplus.

    There must be something simple, that I do not correctly.

    Thank you, Elaine

    Published by: E Langford on 5 June 2013 01:57

    Hi Elaine,.

    Whenever unexpected behavior occurs is not a known bug, I always suspect corruption in the migrated settings / preferences of the user. Is the best way to test this
    1. export definitions of connection, you do not want to lose.
    2. Add the following line to your sqldeveloper.conf file...

    AddVMOption - Dide.user.dir =

    3. restart the product without migrating all settings

    The conf file is \sqldeveloper\sqldeveloper\bin\sqldeveloper.conf. IDE.user.dir must be available in writing being given to whatever your username has privileges (and preferably on a drive off-grid) and must be different from the value default SQL Developer uses (for example, on Windows 7, C:\Users\Developer \AppData\Roaming\SQL).

    If el_ccn.sql script works correctly with the own user preferences, by default, then you can return to the editing of the conf file, delete or rename the folder system3.2.20.09.87 in the ide.user.dir original or default folder, and then restart the product, migrate or does not migrate settings from a previous installation as desired.

    Hope this helps,
    Gary

  • BECAUSE a node: when to stop through SQL * more...


    Hello

    I installed a CCR node for the first time and playing with it to get better knowledge. The underlying cluster has two nodes, call them the Node_A and node_b.

    The cluster database itself is called upon to DEVELOP, DEVELOP_1 instance is running on the node Node_A, instance DEVELOP_2 is supposed to work on node_b. The preferred node is

    NŒUD_A.

    When testing database online relcation everything works as expected: DEVELOP_1 instance Gets the stop on Node_A node - instance DEVELOP_2 is started on node_b.

    But what closing instance DEVELOP_1 on Node_A with SQL * more I was surprised of the result:

    -C' is not instance DEVELOP_2 which began on node_b - it was DEVELOP_1 for instance!  (Because of this my control sews has changed - but is not the issue of this discussion).

    Now my questions are:

    -is the clusterware responsible for the DEVELOP_1 instance on node_b startup behavior when I stop instance DEVELOP_1 down on Node_A via SQL * more?

    - and if this behavior is documented? I went through the RAC documentation node, but could not find something useful

    Any help will be appreciated.

    Rgds

    Jan

    Hi Jan,

    Yes, its expected behavior in a node of the FCAC, please consult the document below.

    "Oracle Real Application Clusters one node Overview" (Page 1) (relocation of the database online)

    http://www.Oracle.com/technetwork/products/Clustering/overview/TWP-rac1nodev1-1-130698.PDF

  • 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

  • Connection with SQL * more is not possible

    Hello together,

    I have a problem with my database and SQL Plus.

    I can't connect to my DB via SQL Plus, I get the error message: > > ORA_12546: TNS: detonation verweigert (Permission denied) < <.

    I tried it with several users. When I try to log in to enterprise manager or connecting to the DB through SQL Developer works very well with the user > > sys < <, only the SQL more connection does not work.

    It works until yesterday that there are some problems with the DB and the processor and RAM were almost 100% occupied each.


    We use the Version 11 g Enterprise Edition Release 11.2.0.1.0 64 bit Production on a Windows Server 2008 R2 Enterprise Server.

    I am running SQL Plus, Enterprise Manager and SQL Developer directly on the DB server.

    When I start SQL Plus he asks me my username > > enter user name: < < and after that my password: > > password: < <.

    A connection as seen in many forums or document on the internet like > > scott/tiger@ORCL < < never worked on my system, which is also confused me.


    We have no listener.ora file in the folder: ORACLE_HOME/NETWORK/ADMIN only a sqlnet.ora with line > > SQLNET. AUTHENTICATION_SERVICES = (NTS) < < in it.



    Status of the listener:

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

    C:\Windows\System32 > lsnrctl status

    LSNRCTL for 64-bit Windows: Version 11.2.0.1.0 - Production on 18 February 2014 12:14:32

    Copyright (c) 1991, 2010, Oracle.  All rights reserved.

    Connection to (ADDRESS = (PROTOCOL = tcp)(HOST=) (PORT = 1521))

    STATUS of the LISTENER

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

    Alias LISTENER

    TNSLSNR for Windows 64-bit version: Version 11.2.0.1.0 - Production

    Start date February 18, 2014 10:15:54

    Uptime 0 days 1 hour 58 minutes 42 seconds

    Draw level off

    Security ON: OS Local Authentication

    SNMP OFF

    O:\app\administrator\diag\tnslsnr\QualisysDbNbg\listener\alert\log.XML log listener

    Summary of endpoints listening...

    (DESCRIPTION = (ADDRESS = (PROTOCOL = tcp)(HOST=QualisysDbNbg) (PORT = 1521)))

    Summary of services...

    Service "orcl" has 1 instance (s).

    Instance "orcl", State LOAN, has 1 operation for this service...

    The command completed successfully

    C:\Windows\System32 >

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


    I hope someone can help me with this problem.


    Thank you you very much in forward for your answerand greetings

    Matthias


    The sys user must connect as sysdba

    have you tried

    sqlplus 'sys@ORCL as sysdba'

    or

    sqlplus 'sys/yoursyspwd@ORCL as sysdba'

    the first command should work without password for all users group ORA_DBA.

    Scott, the user cannot also exists in your database.

  • Can I connect to SQL * more as SYS after connecting as a user and then run a GRANT?

    Oracle 11 g 2

    Linux RHEL 6.3

    SQL * Plus 11.2.0.2 on Windows 7

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

    I am running a script SQL through SQL * more connected as "DOE, JOHN".

    In the SQL script, I need to connect as SYS to make a GRANT EXECUTE on a SYS package (e.g. GRANT EXECUTE ON DBMS_CRYPTO to JOHN;).

    But it fails with the following error:


    GRANT EXECUTE ON TO JOHN DBMS_CRYPTO
    *
    ERROR on line 1:
    ORA-01917: user or role 'JOHN' does not exist

    But of course, 'JOHN' are.  The rest of the SQL script is running "DOE, JOHN" without any problem.

    The code segment of SQL script in question is:

    connect sys/password as sysdba
    GRANT EXECUTE ON DBMS_CRYPTO TO ROYSECITYDATA;  <-fails here
    to connect/DOE

    Please advise on what my being the issue.

    tx103108 wrote:

    I connect to a remote database.  All dbs distance have the same instance name as they are all images.  I see where you're going (I think).  Should I try

    I'll try to connect sys/password@MYDB

    Sounds like a plan... (the instance_name returned with what you expected? or something else?)

  • 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

  • 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.

  • Privileges differ between SQL * more and stored procedure

    A user with the dba role can access dba_role_privs. But this is not possible in a stored procedure created by the same user.
    Normally, the example should work fine
    But with Oracle XE 11.02 - cost free database with some limitations - I get error 942

    I show a simple example in SQL * more:

    SQL > r
    1 * select distinct dba_role_privs recipient where the recipient as "SY %.

    DEALER
    ------------------------------
    SYSTEM
    SYS

    SQL > create or replace procedure x as
    2 start
    3 for rec in (select distinct dba_role_privs dealer where the beneficiary as 'SY %')
    4 loop
    5 zero;
    6 end of loop;
    7 end;
    8.

    Warnung: Prozedur wurde mit Kompilierungsfehlern standing.
    English translation: procedure created with compilation errors

    SQL > show error

    LINE/COL ERROR
    -------- -----------------------------------------------------------------
    3/14 PL/SQL: statement ignored
    3/43 PL/SQL: ORA-00942: table or view does not exist
    SQL >

    How can I fix?

    Why do you think the example should work properly?

    Normally, regardless of the version, the privileges granted through roles (such as DBA) not available for stored procedures. Stored procedure of a DEFINER rights can only take advantage of the privileges granted directly to the owner of the procedure. Stored procedure of the invoker rights can enjoy privileges granted by a role, but that requires that the appellant has independent privileges to query the table in question (and, in this case, would require dynamic SQL usage).

    Generally, the simplest approach would be to grant the privilege to CHOOSE ANY DICTIONARY to the owner of the procedure.

    Justin

  • SQL * more: how to avoid asking them &amp; 1?

    I use a parameter within a SQL Script more to set a value for the creation of different environments.
    DEFINE _env = '&1'
    The parameter & 1 is used. However, a NULL value is allowed. But if this parameter is not defined, sql * more guests to enter something for & 1. How can we avoid this?

    SQL use
    sqlplus user/password@database @test_parameter.sql
    
    SQL> exit
    
    Verbunden mit:
    Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
    With the Partitioning, Oracle Label Security, OLAP, Data Mining,
    Oracle Database Vault and Real Application Testing options
    
    "Geben Sie einen Wert f³r 1 ein:"
    
    SQL> prompt Env&_env.
    Env
    SQL>
    I'm looking for an easy way avoid the message < font color = "red" > "enter a value for 1:" < / police > if no parameter is added.
    If a parameter is added, this message does not appear.
    sqlplus user/password@database @test_parameter.sql _TST
    example script
    -- set environment 
    ------------------
    -- Allowed values are 
    -- "_DEV" = Development 
    -- "_TST" = Test
    -- "" = Production)
    set verify off
    
    DEFINE _env = '&1'
    
    begin 
      if '&_env' is null 
        or regexp_like ('&_env', '_[[:alnum:]]{3}') then 
         null; --ok
      else
        raise_application_error(-20000,'Parameter 1 (''&_env'') has wrong value. Must start with _ and only 3 letters or be empty.' );
      end if;
    end;
    /
    
    set echo on
    
    prompt env&_env.
    Published by: Sven w. March 15, 2012 16:40

    When you want to call it "parameterless" give a string empty (two single quotes) like this:

    sqlplus user/password@database @test_parameter.sql ''
    
  • 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.

  • limitation in the use of sql * more like a database for applications

    Dear expert;

    I would like to know everything, what are some of the main limitations using sql * more as your database in the application in addition to designing the user interface is pretty nice... and google does not produce answers to my questions also unfortunately

    user13328581 wrote:
    I don't know about the drivers, I just need an IDE that is very similar to the PL/SQL Developer who will give me the opportunity to create the tables and their relationships and other tasks DDL that is why, at the beginning I was just wondering if it is OK to use sql * more for everything that...

    Yes, sqlplus allows you to do what you want

  • Detection of parameter NLS_LANG clientside in SQL * more script

    Our company has developed an application that uses an Oracle database as backend. Companies can purchase our application and run it against their own installation of Oracle.

    A new version of our application often requires an update to the Oracle database schema.
    As well as from new application files, we send our customers an update.sql script, they must run to their database using SQL * more.
    This update script can contain international characters such as é for example:
    UPDATE SHOPS SET DESCRIPTION = 'Café'
    WHERE SHOP_ID=1
    Save us the SQL script file in the windows-1252 encoding the character e is encoded by 0xE9 in the script file.

    When the ADMINISTRATOR runs him upgrade script is set NLS_LANG =. WE8MSWIN1252 it works perfectly.
    When the ADMINISTRATOR has set the NLS_LANG = US7ASCII the e is replaced by an exclamation mark the upside. Other NLS_LANG settings can also be embarrassing.

    To avoid this, we give very clear instructions. However, nobody reads. This raises two questions:

    (A) is there a way to prevent this problem, so I do not the parameter NLS_LANG by the DBA to run the upgrade script depend on?
    (B) otherwise: is there a way to test the NLS_LANG setting in the script and give up if it's not WE8MSWIN1252?

    Info:
    Database is 10.2.0.3/10.2.0.4 and sometimes 10.2.0.5, always the database character set WE8MSWIN1252.
    Client software: I don't know what are the uses each s/n, but it will be mainly the software client 10g
    Client OS: Some DBA will run the script from Windows, others of some varieties of Unix. I can't control that.

    (A) is there a way to prevent this problem, so I do not the parameter NLS_LANG by the DBA to run the upgrade script depend on?

    Yes. Use the UNISTR function to encode strings with Unicode, for example UNSITR('\00e9') exhausts to code 'e '. The set conversion implicit character in the set to the national character of database character set will do. You can use the ASCIISTR function to simplify the creation of arguments to UNISTR based on the input text.

    -Sergiusz

  • Windows system environment variables in "Sql * more»

    Can I use/reference of Windows system environment variables in "Sql * more?
    For example, I want to create sql-script runs in the database server computer that variable is "ORA_HOME", uses this value to perform a few sentences of sql/plsql.

    Oracle 10g personal, Windows 7.

    Edited by: CharlesRoos the 12.11.2010 17:28

    CharlesRoos wrote:
    The business problem:
    I created 2 databases in my computer. The two databases needs storage created by a script. The names of data files (.dbf files) of storage are the same for the two database. The two database has its own directory, where it holds data for the moment files. At the moment the data files for Database1 are in the folder something like '% ORACLE_HOME%"\oradata\%databasename1%\*.dbf and the second base of data has its data files in the other folder, somewhere '' % ORACLE_HOME%"\oradata\%databasename1%\*.dbf'. Now I want the script to create the tablespace called "INDX" with the same data file name "indx1.dbf" in the two database. If in the two documents mentioned the 'indx1.dbf' file must be created by the script. I think the script must do following:

    1. get ORACLE_HOME.
    2. connect to database "databasename1"
    3. EXECUTE IMMEDIATE "Create TableSpace INDX....file=%ORACLE_HOME% || databasename1 || indx1.dbf"
    4. connect to database "databasename2"
    5. EXECUTE IMMEDIATE "Create TableSpace INDX....file=%ORACLE_HOME% || databasename2 || indx1.dbf"
    

    I don't have database Oracle close more, if the code was pseudo-code.

    ---

    I do not understand how to use?-shortcut.

    OK, my first impression is ' why must even be scripted? Creation of new spaces of storage is usually a one-off operation.

    But what side this substitution of sqlplus command line variables. This example is Linux, but works on Windows with the change in the way environment variables are referenced:

    * echo nix - $myvariable
    Windows - echo myvariable %

    First of all, sqlscript to create the TS. Note the use of the substitution variable '& 1 '.
    {code}
    [oracle@vmlnx01 ~] $ cat makets.sql cat
    set echo on the comments on check on trimsp on
    Guest & 1
    --
    CREATE TABLESPACE EDSTEST PETIT_FICHIER
    DATAFILE ' / ora01/oradata/&1/edstest.dbf'
    SIZE 5 M
    REUSE
    AUTOEXTEND ON
    NEXT 1280K
    MAXSIZE 32767M
    LOGGING
    LOCAL MANAGEMENT MEASURE
    SEGMENT SPACE MANAGEMENT AUTO
    ;
    --
    Drop tablespace edstest
    including content and data files
    ;
    output
    {code}

    Thus, the OS invites: note that the @ is separated by a space, which makes a parm from command line instead of the part of the connection string

    {code}
    [oracle@vmlnx01 ~] $ export myparm = vlnxora1
    [oracle@vmlnx01 ~] $ sqlplus system/pswd @makets $myparm

    SQL * more: Release 10.2.0.4.0 - Production on Fri Nov 12 18:13:05 2010

    Copyright (c) 1982, 2007, Oracle. All rights reserved.

    Connected to:
    Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Production
    With partitioning, OLAP, Data Mining and Real Application Testing options

    SQL > prompt & 1
    vlnxora1
    SQL >--
    SQL > CREATE TABLESPACE EDSTEST PETIT_FICHIER
    2 DATAFILE ' / ora01/oradata/&1/edstest.dbf'
    3 SIZE 5 M
    4 REUSE
    5 AUTOEXTEND ON
    6. THE NEXT 1280K
    7 MAXSIZE 32767M
    8 LOGGING
    MEASURE 9 LOCAL MANAGEMENT
    10 SEGMENT SPACE MANAGEMENT AUTO
    11;
    2 old: DATAFILE ' / ora01/oradata/&1/edstest.dbf'
    2 new: DATAFILE ' / ora01/oradata/vlnxora1/edstest.dbf'

    Created tablespace.

    SQL >--
    SQL > drop tablespace edstest
    2 content and data files including
    3;

    Tablespace has fallen.

    SQL > exit
    Disconnected from the database to Oracle 10 g Enterprise Edition Release 10.2.0.4.0 - Production
    With partitioning, OLAP, Data Mining and Real Application Testing options
    [oracle@vmlnx01 ~] $
    {code}

Maybe you are looking for