creating a package in sql * more

Hello all;

Do you know what the problem with that statement
SQL> create or replace pkg_initial_comment as procedure save_initial_comment(p_i
d number, p_first_name varchar2, p_last_name varchar2, p_comment varchar2, p_dat
e date); end save_initial_comment; create or replace package body pkg_initial_co
mment as procedure save_initial (p_id number, p_comments varchar2, p_first_name
varchar2, p_last_name varchar2, p_date date) is begin insert into initial_commen
ts values (1, p_first_name, p_last_name, p_comment, sysdate); end save_initial;
end pkg_initial_comment;
create or replace pkg_initial_comment as procedure save_initial_comment(p_id num
ber, p_first_name varchar2, p_last_name varchar2, p_comment varchar2, p_date dat
e); end save_initial_comment; create or replace package body pkg_initial_comment
 as procedure save_initial (p_id number, p_comments varchar2, p_first_name varch
ar2, p_last_name varchar2, p_date date) is begin insert into initial_comments va
lues (1, p_first_name, p_last_name, p_comment, sysdate); end save_initial; end p
kg_initial_comment
I get the following error message

ORA-00922:

and my table structure is less than
create table initial_comment (id number(30),
first_name varchar2(4000), last_name varchar2(4000), create_date date);

're missing you the keyword package after first replace.

Good bye
DPT

Tags: Database

Similar Questions

  • Error [PLS-00103: encountered the symbol "CREATE"] using PACKAGE

    Hi guys!
    When I compile this package, I get this error:
    PLS-00103: encountered the symbol "CREATE".

    How can I solve this problem?
    The compiled code is below:


    CREATE OR REPLACE
    PACKAGE CAMPO_PACK AS

    TYPE T_CURSOR IS REF CURSOR;

    PROCEDURE DeleteCode (OSDP NUMBER);

    END CAMPO_PACK;
    -body-
    CREATE or REPLACE PACKAGE BODY CAMPO_PACK as

    PROCEDURE DeleteCode(pCod NUMBER) AS
    BEGIN
    DELETE FROM campo
    WHERE cod = OSDP;
    END DeleteCode;

    END CAMPO_PACK;


    Thanks for the help,
    Anderson



    Published by: user8723300 on 08/13/2009 17:03

    Published by: user8723300 on 08/13/2009 17:04

    I use Oracle SQL Developer

    I know very well of this tool.

    The packet header and body are two separate objects and must be compiled separately. I suspect that the package body is somehow have included in package header and Developer SQL tries to compile all of these at once. You must understand how to compile the header first, then the body. Your code compiles if I use sqlplus. I had to first create the table, so I have included a slash (/) after the packet header and the other after that body. The slash tells sql more to run the buffer (in this case, to compile the object).

    SQL> create table campo (cod number);
    
    Table created.
    
    SQL> CREATE OR REPLACE
      2  PACKAGE CAMPO_PACK AS
      3
      4  TYPE T_CURSOR IS REF CURSOR;
      5
      6  PROCEDURE DeleteCode(pCod NUMBER);
      7
      8  END CAMPO_PACK;
      9  /
    
    Package created.
    
    SQL> CREATE OR REPLACE PACKAGE BODY CAMPO_PACK AS
      2
      3  PROCEDURE DeleteCode(pCod NUMBER) AS
      4  BEGIN
      5  DELETE FROM campo
      6  WHERE cod = pcod;
      7  END DeleteCode;
      8
      9  END CAMPO_PACK;
     10  /
    
    Package body created.
    

    If I remove the slash after the package header, sql more trying to compile all this at once, and I get the same error you get:

    SQL> CREATE OR REPLACE
      2  PACKAGE CAMPO_PACK AS
      3
      4  TYPE T_CURSOR IS REF CURSOR;
      5
      6  PROCEDURE DeleteCode(pCod NUMBER);
      7
      8  END CAMPO_PACK;
      9
     10  CREATE OR REPLACE PACKAGE BODY CAMPO_PACK AS
     11
     12  PROCEDURE DeleteCode(pCod NUMBER) AS
     13  BEGIN
     14  DELETE FROM campo
     15  WHERE cod = pcod;
     16  END DeleteCode;
     17
     18  END CAMPO_PACK;
     19  /
    
    Warning: Package created with compilation errors.
    
    SQL> sho err
    Errors for PACKAGE CAMPO_PACK:
    
    LINE/COL ERROR
    -------- -----------------------------------------------------------------
    9/1      PLS-00103: Encountered the symbol "CREATE"
    
  • Create the PL/SQL package in SQL Developer 4.0.0.12

    Hello

    I built a model in SQL Developer 4.0.0.12 and I want to create a PL/SQL package.

    In ODMiner 11.1.0.4 of 'Tools' > 'Create pl/sql package' I can get a script to create the package and every thing is OK.

    but in SQL Developer, I select "Deploy" from the popup menu of each node and it generates a folder containing scripts associated with each node. I don't see any relevant script for creating a package.

    How can I create a PL/SQL package in my workflow?

    Thanks for any help you can provide in this situation.

    Please see this whitepaper to find out how to build the PL/SQL package for deployment of workflow:

    Oracle Data Miner (Extension of SQL Developer 4.0)

    PL/SQL script for the deployment of workflow

    http://www.Oracle.com/technetwork/database/options/advanced-analytics/odmrcodegenwhitepaper-2042206.PDF

  • table/view not found when creating a package, but can execute sql...

    I'm trying to create a package I'm ora-00942 table or view does not exsit, but when I run with the same user tries to create the package in the sql statement that gives NO error through fine.

    Any idea what can cause that?

    -drop table demo_hdr_trgt

    -drop table demo_hdr_stg

    -It's the tabe belong to the other user not my own schema

    connect tstdata/tstdata

    create the table demo_hdr_stg as floor (dbms_random.value (1,101)) select id, floor (dbms_random.value (1001,100001)) double amt connect by level < = 100

    /

    -It's my diagram

    connect me3/me3

    create the table demo_hdr_trgt in select * from hdr_stg where 1 = 0

    /

    Select * from tstdata.demo_hdr_stg by id

    /

    Select * from demo_hdr_trgt by id

    /

    -business for this temporary table to demo rule

    ALTER TABLE demo_hdr_trgt add PRIMARY KEY (id)

    /

    -table to the control of the error for the DML

    Start

    DBMS_ERRLOG. CREATE_ERROR_LOG('tstdata.) DEMO_HDR_STG');

    end

    /

    -Follow-up of the load table if he succeeds

    CREATE TABLE demo_RESULT_TAB

    (VARCHAR2 (100) 'RUN_NAME',)

    VARCHAR2 (100) "V_MODULE."

    VARCHAR2 (100) "V_ACTION."

    NUMBER OF "ROWCOUNT".

    )

    /

    -Follow-up of the other error table

    CREATE TABLE demo_ERROR_TAB

    (VARCHAR2 (100) 'RUN_NAME',)

    VARCHAR2 (100) "V_MODULE."

    VARCHAR2 (100) "V_ACTION."

    NUMBER OF "SQLCODE"

    "SQLERRM' VARCHAR2 (4000).

    "CALL_STACK' CLOB

    )

    /

    -package charge demo

    create or replace package demo_hdr_pkg as

    procedure hdr_ldr (run_name varchar2);

    end demo_hdr_pkg

    /

    create or replace package body demo_hdr_pkg as

    procedure hdr_ldr (run_name varchar2) is

    number of v_sqlcode;

    v_sqlerrm varchar2 (1000);

    v_module varchar2 (100): = "demo_hdr_pkg.hdr_ldr";

    v_action varchar2 (100): = "insert into hdr_trgt";

    number of v_rowcount;

    Start

    DBMS_APPLICATION_INFO.set_module (module_name = > v_module,)

    action_name = > v_action);

    -the sql code that gives ora-00942 errors that I can review independent

    -INSERT / * + append PARALLEL * /.

    INSERT / * + PARALLEL * /.

    IN demo_hdr_trgt, SELECT id, tstdata.demo_hdr_stg amt

    LOG ERRORS IN tstdata. ERR$ (run_name) _demo_HDR_STG

    REJECT LIMIT UNLIMITED;

    v_rowcount: = number of lines sql %;

    INSERT into demo_result_tab (run_name, v_module, v_action, rowcount) values (run_name, v_module, v_action, v_rowcount);

    commit;

    exception when others then

    dbms_output.put_line(SQLCODE||) e '|| SQLERRM);

    v_sqlcode: = sqlcode;

    v_sqlerrm: = sqlerrm;

    insert into demo_error_tab (run_name, v_module, v_action, sqlcode, sqlerrm, call_stack) values (run_name, v_module, v_action, v_sqlcode, v_sqlerrm, dbms_utility.format_call_stack);

    commit;

    -dbms_scheduler to analyze the error table and send e-mail

    end;

    end demo_hdr_pkg

    /

    -test

    declare

    v_runname varchar2 (100): = to_char (sysdate, 'YYYY_MM_DD_HH24_MI_SS');

    Start

    demo_hdr_pkg.hdr_ldr (v_runname);

    end

    /

    Select * from demo_hdr_stg by id

    /

    Select * from demo_hdr_trgt by id

    /

    Select * from demo_error_tab

    /

    Select * from demo_result_tab

    /

    This question is asked almost every day...

    http://martincarstenbach.WordPress.com/2010/05/27/the-difference-between-a-direct-grant-and-a-role-in-PLSQL/

    Summary, you need a DIRECT grant (not through a role), or you could modify the procedure to use the rights of the appellant (the default is rights define).

    See you soon,.

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

  • execution of stored procedure in sql developer/sql more with a table setting?

    Hello

    I create a package with a procedure which has a cursor ref as output and a type as an input parameter.  Here is my definition of the package

    PACKAGE 
    -------
    CREATE OR REPLACE PACKAGE TEST
    As
      TYPE RefCursorType IS REF CURSOR;
      type intTableType is table of varchar2(50) index by binary_integer;
      
      PROCEDURE GETDATA (
              P_RECORDS OUT RefCursorType,           
               YEAR_LIST IN intTableType
      );  
    END;
    
    
    PACKAGE BODY
    -----------------------
    
    SET DEFINE OFF
    CREATE OR REPLACE PACKAGE BODY TEST
    AS 
    PROCEDURE GETDATA
    (
      P_RECORDS OUT RefCursorType,  
      YEAR_LIST IN intTableType  
    )
    AS 
    iYearList  IDTableType;
    BEGIN 
      --GET ARRAY COUNT
      IYEARLIST := IDTABLETYPE();
      IYEARLIST.EXTEND(YEAR_LIST.COUNT);
      
      --LOOP THROUGH LISTS AND POPULATE ARRAY
      FOR I IN YEAR_LIST.FIRST .. YEAR_LIST.LAST
      LOOP
      IYEARLIST(I) := IDTYPE(TO_CHAR(YEAR_LIST(I)));
      END LOOP;
      
       OPEN P_RECORDS FOR 
       SELECT CITHTML AS FORMATTED
        FROM dbTest.FORMATTED_HTML
      WHERE YEAR IN (SELECT * FROM TABLE(IYEARLIST))
      ;
      END GETDATA ;
    END TEST ;
    /
    
    

    I want to perform this procedure from the sql or sql developer more to see if it works properly.   The year field dbTest.FORMATTED_HTML is defined as varchar2 (20 bytes).  He has many years as well as text.

    I've used this in the past with simple stored procedures, but not those with a table setting

    var r refcursor;

    exec GETOLDDATA(:r,40);

    print r;

    How can I modify this to allow him to run my stored procedure?

    Thank you

    Just declare SQL, not type of PL/SQL:

    CREATE OR REPLACE

    TYPE Str50TblType

    AS THE TABLE OF THE VARCHAR2 (50)

    /

    CREATE OR REPLACE

    THE TEST PACKAGE

    IS

    GETDATA PROCEDURE)

    P_RECORDS ON SYS_REFCURSOR,

    YEAR_LIST IN Str50TblType

    );

    END;

    /

    CREATE OR REPLACE

    TEST OF PACKAGE BODY

    IS

    GETDATA PROCEDURE)

    P_RECORDS ON SYS_REFCURSOR,

    YEAR_LIST IN Str50TblType

    )

    IS

    BEGIN

    OPEN P_RECORDS

    FOR

    SELECT CITHTML AS FORMATTED

    OF dbTest.FORMATTED_HTML

    WHERE YEAR IN)

    SELECT *.

    TABLE (YEAR_LIST)

    );

    GETDATA END;

    END TEST;

    /

    SY.

  • Creating a package problems

    Hello

    I need to create a package with a procedure that would create a new rocords of table and copy of the employees table.

    So first of all, I am creating a procedure:

    create or replace

    procedure create_table (employee_id IN employees.employee_id%TYPE) as

    Employe_id. employees number % TYPE;

    First name employees. FIRST_NAME % TYPE;

    Employees last_name. LAST_NAME % TYPE;

    E-MAIL eployees. EMAIL OF THE TYPE DESTINATAIRE%.

    PHONE_NUMBER eployees. PHONE_NUMBER % TYPE;

    HIRE_DATE eployees. HIRE_DATE % TYPE;

    Job_id eployees. JOB_ID % TYPE;

    Eployees SALARY. % SALARY TYPE.

    Eployees.COMMISSION_PCT%TYPE COMMISSION_PCT;

    Eployees MANAGER_ID. MANAGER_ID % TYPE;

    Department_id eployees. DEPARTMENT_ID % TYPE;

    Start

    run immediately "CREATE TABLE MY_TABLE

    (EMPLOYE_ID, NUMBER (6,0),)

    NAME VARCHAR2 (20 BYTE)

    VARCHAR2 (25 BYTE) LAST_NAME,

    E-MAIL VARCHAR2 (25 BYTE),

    PHONE_NUMBER VARCHAR2 (20 BYTE),

    HIRE_DATE DATE,

    JOB_ID VARCHAR2 (10 BYTE),

    NUMBER (8.2) OF SALARY.

    COMMISSION_PCT NUMBER (2.2).

    MANAGER_ID NUMBER (6.0).

    NUMBER (4,0)) DEPARTMENT_ID ';

    SOME employees. Employee_id IN number of employees;

    SOME employees. First name IN first name OF employees;

    SOME employees. Last_name IN LAST_NAME of employees;

    SELECT eployees. PHONE_NUMBER IN PHONE_NUMBER of employees;

    SELECT eployees. HIRE_DATE IN HIRE_DATE from employee;

    SELECT eployees. Job_id IN the JOB_ID OF THE employees;

    SELECT eployees. WAGES IN COMPENSATION OF employees;

    SELECT eployees.COMMISSION_PCT IN COMMISSION_PCT FROM employees;

    SELECT eployees. MANAGER_ID IN MANAGER_ID OF employees;

    SELECT eployees. Department_id IN department_id from employee;

    INSERT INTO my_table VALUES)

    employe_id,

    FIRST NAME,

    LAST_NAME,

    E-mail

    PHONE_NUMBER,

    HIRE_DATE,

    JOB_ID,

    SALARY,

    COMMISSION_PCT,

    MANAGER_ID,

    DEPARTMENT_ID);

    end CREATE_TABLE;

    And get errors:

    PL/SQL: Analysis of completed Compilation unit

    PLS-00410: fields in duplicate in the FOLDER list, TABLE or argument are not allowed

    P.S. First time creation of package and procedure.

    Seems a strange way of doing things when you can use a table to create as select, but it looks like a puzzle of coding or something.

    This will do what you want.  It checks to see if the table exists, if not, it creates and populates.

    create or replace procedure CREATE_TABLE is

    TableExists (pTableName varchar2) return boolean is

    vCnt whole;

    Start

    Select count (*)

    in vCnt

    tab

    where TNOM = pTableName;

    Return vCnt > 0;

    end;

    Start

    If TableExists ('MY_TABLE') then

    run immediately "CREATE TABLE MY_TABLE)

    EMPLOYE_ID NUMBER (6.0).

    NAME VARCHAR2 (20 BYTE)

    VARCHAR2 (25 BYTE) LAST_NAME,

    E-MAIL VARCHAR2 (25 BYTE),

    PHONE_NUMBER VARCHAR2 (20 BYTE),

    HIRE_DATE DATE,

    JOB_ID VARCHAR2 (10 BYTE),

    NUMBER (8.2) OF SALARY.

    COMMISSION_PCT NUMBER (2.2).

    MANAGER_ID NUMBER (6.0).

    DEPARTMENT_ID NUMBER (4.0)

    )';

    execute "insert into my_table (EMPLOYEE_ID, FIRST_NAME, LAST_NAME, EMAIL, PHONE_NUMBER, HIRE_DATE, JOB_ID, SALARY, COMMISSION_PCT, MANAGER_ID, department_id) immediately

    Select EMPLOYEE_ID, FIRST_NAME, LAST_NAME, EMAIL, PHONE_NUMBER, HIRE_DATE, JOB_ID, SALARY, COMMISSION_PCT, MANAGER_ID, department_id

    of WORKERS;

    end if;

    end CREATE_TABLE;

    or better yet, if your puzzle allows you to use a DEC:

    create or replace procedure CREATE_TABLE is

    TableExists (pTableName varchar2) return boolean is

    vCnt whole;

    Start

    Select count (*)

    in vCnt

    tab

    where TNOM = pTableName;

    Return vCnt > 0;

    end;

    Start

    If TableExists ('MY_TABLE') then

    run immediately "CREATE TABLE MY_TABLE as

    Select EMPLOYEE_ID, FIRST_NAME, LAST_NAME, EMAIL, PHONE_NUMBER, HIRE_DATE, JOB_ID, SALARY, COMMISSION_PCT, MANAGER_ID, department_id

    of WORKERS;

    end if;

    end CREATE_TABLE;

  • SQL * more substitution vs bind variable question

    Hi all, I am trying to automate some SQL within SQL codes * more script that is triggered by a script .bat, the only parts that change are Dates...

    example:

    create table blah as

    Select * from table

    WHERE DATE between start_date and END_DAY;

    the DATE is a numeric field, YYYYMMDD

    The script runs always at the beginning of a new week, so a Monday, unless a public holiday, then a Tuesday.

    The END_DAY is * always * last Friday and I realized that:

    variable L_FRIDAY char (15);

    Start

    Select to_char (next_day(sysdate-7,'FRIDAY'), 'YYYYMMDD') as Last_Friday in: double L_FRIDAY;

    end;

    /

    The thing is that I get an error when I try to use the binding variable?

    create table blah as

    Select * from table

    WHERE DATE between start_date and: L_FRIDAY;

    Then once I found the end date, I was going to use add_months(L_FRIDAY,-12) for previous 12 months for the start_date...

    When I tried to use a variable Substitution I could just hard code the date, but I can not or do not know how to set the value of this exec to the variable?

    Help!

    :-)

    Basically my research reveals that - Bind variables are not allowed for operations of data definition, use substutions instead of bind variables

    I need an automated way to find the END_DAY which is last Friday and START_DATE that is 12 months before Friday and refer to those in the SQL without errors.

    Hello

    Kodiak_Seattle wrote:

    Hi all, I am trying to automate some SQL within SQL codes * more script that is triggered by a script .bat, the only parts that change are Dates...

    example:

    create table blah as

    Select * from table

    WHERE DATE between start_date and END_DAY;

    the DATE is a numeric field, YYYYMMDD

    The script runs always at the beginning of a new week, so a Monday, unless a public holiday, then a Tuesday.

    The END_DAY is * always * last Friday and I realized that:

    variable L_FRIDAY char (15);

    Start

    Select to_char (next_day(sysdate-7,'FRIDAY'), 'YYYYMMDD') as Last_Friday in: double L_FRIDAY;

    end;

    /

    The thing is that I get an error when I try to use the binding variable?

    create table blah as

    Select * from table

    WHERE DATE between start_date and: L_FRIDAY;

    Then once I found the end date, I was going to use add_months(L_FRIDAY,-12) for previous 12 months for the start_date...

    When I tried to use a variable Substitution I could just hard code the date, but I can not or do not know how to set the value of this exec to the variable?

    Help!

    :-)

    Basically my research reveals that - Bind variables are not allowed for operations of data definition, use substutions instead of bind variables

    I need an automated way to find the END_DAY which is last Friday and START_DATE that is 12 months before Friday and refer to those in the SQL without errors.

    Or SQL * more bind variable or variable substitution can be DATEs.  The best you can do is set a different type, as a string, representing a date.  A string as June 19, 2015"represents a date, but so strings like 'SYSDATE' and ' SYSDATE - 7', so you can do something like this:

    SET l_friday = ' NEXT_DAY ((SYSDATE-7), 'FRIDAY').

    DEFINE start_date = "ADD_MONTHS (& l_friday, - 12)"

    SELECT & start_date AS t_n

    , & l_friday AS l_f

    OF the double

    ;

    Output (when executed on 25 June 2015):

    L_F T_N

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

    June 19, 2014 19 June 2015

  • SQL more how to stop script after the exception of the DDL

    Hello

    I have script .sql, which I managed by SQL * more.

    Some migration of data and database structure changes were made in the script.

    So, I use a lot of distinct calls:

    @script_name.sql

    @script_name_1.sql

    @script_name_2.sql

    ...

    Some of the scripts contains DDL as create table or column.

    contains some declare blocks (DML).

    Is it possible to stop the script after an exception has occurred?

    Thank you, Olga.

    Hi, Olga.

    You can use the SQL * more order

    WHENEVER SQLERROR EXIT

    to tell SQL * more to stop the execution of orders and immediately disconnect after any exception SQL is triggered.

    I don't know of anyway to stay connected, but to stop script execution, after an error.

  • Cannot access SQL more from other than the Oracle users

    Hello

    I installed Oracle 11 g R2 on Red Hat 6. My problem is that I can't access sqlplus from other than the oracle users.

    I put the PATH, the ORACLE_HOME and ORACLE_SID to the correct values.

    Session1

    Connect as: oracle

    [email protected] password:

    Last login: Sun Aug 24 01:24:46 192.168.202.1 2014

    [oracle@localhost ~] $ echo $PATH

    /usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/Home/Oracle/bin:/Home/Oracle/app/Oracle/product/11.2.0/dbhome_1/bin

    [oracle@localhost ~] $ echo $ORACLE_HOME

    /Home/Oracle/app/Oracle/product/11.2.0/dbhome_1

    [oracle@localhost ~] $ echo $ORACLE_SID

    ORCL

    [oracle@localhost ~] $ sqlplus

    SQL * more: Production release 11.2.0.1.0 Sun Aug 24 03:17:32 2014

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

    Enter the user name:

    Session2

    Connect as: nada

    [email protected] password:

    Last login: Sun Aug 24 02:31:49 192.168.202.1 2014

    [prithwish@localhost ~] $ export PATH=$PATH:/home/oracle/app/oracle/product/11.2.0/dbhome_1/bin

    [prithwish@localhost ~] $ export ORACLE_HOME=/home/oracle/app/oracle/product/11.2.0/dbhome_1

    [prithwish@localhost ~] $ export ORACLE_SID = orcl

    [prithwish@localhost ~] $ echo $ORACLE_HOME

    /Home/Oracle/app/Oracle/product/11.2.0/dbhome_1

    [prithwish@localhost ~] $ echo $ORACLE_SID

    ORCL

    [prithwish@localhost ~] $ echo $PATH

    /usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/Home/Prithwish/bin:/Home/Oracle/app/Oracle/product/11.2.0/dbhome_1/bin

    [prithwish@localhost ~] $ sqlplus

    -bash: sqlplus: command not found

    I guess that I could not access sqlplus as the Nada the user has no access to X11R6

    [prithwish@localhost ~] $ cd...

    [Host prithwish@localhost] $ ls - ltr

    Total 8

    drwx-. 30 oracle oinstall 4096 23 August 23:51 oracle

    drwx-. Nada Nada 4096 24 August to 02:33 27 Mathieu

    [Host prithwish@localhost] $

    My question is, although quite stupid, that double

    (1) I have to change the permissions of the directory oracle of 755 for any other user to access the sqlplus?

    (2) why is the user directory under the folder created with permissions of 700, even when the umask is set to 002? Change the permissions of the directory under/Home oracle will cause security problems?

    My apologies for being naïve. It's the first time I installed Oracle under UNIX

    Kind regards

    Prithwsh

    Actually, the default procedure is NOT to install oracle to X11R6, but in/opt/oracle. or maybe/usr/local/oracle.

    This is what you're going to be recommended in the installation documentation, and in doing so, don't forget to run rootpre.sh and root.sh, I never had security problems and could run Oracle from any account.

    Sybrand Bakker

    Senior Oracle DBA

  • SQL * more question: unprinted despite SET ECHO ON command

    RDBMS Version: 11.2.0.4

    OS: Oracle Linux 6.4 (bash shell)

    I'm kinda a newbie to SQL * more.

    Here's a SQL * Plus script embedded in bash script that scales multiple data files. This script has been run on the DB server side.

    #! / bin/bash

    export ORACLE_SID = ORCL1

    echo "resize Datafile began to" 'date '.

    sqlplus "/ as sysdba" < < EOF

    set echo on

    Set of feedback on

    ALTER DATABASE DATAFILE '+ DATA/brfcsprd/datafile/manh_audit_lob.338.834340223' resize 25g;

    ALTER DATABASE DATAFILE '+ DATA/brfcsprd/datafile/manh_audit_lob.337.834340223' resize 25g;

    ALTER DATABASE DATAFILE '+ DATA/brfcsprd/datafile/manh_audit_lob.336.834340225' resize 25g;

    ALTER DATABASE DATAFILE '+ DATA/brfcsprd/datafile/manh_audit_lob.335.834340225' resize 25g;

    ALTER DATABASE DATAFILE '+ DATA/brfcsprd/datafile/manh_audit_lob.334.834340225' resize 25g;

    ALTER DATABASE DATAFILE '+ DATA/brfcsprd/datafile/manh_audit_lob.333.834340225' resize 25g;

    ALTER DATABASE DATAFILE '+ DATA/brfcsprd/datafile/manh_audit_lob.332.834340227' resize 25g;

    quit smoking

    EXPRESSIONS OF FOLKLORE

    echo "resize Datafile ended in" 'date '.

    As you can see, the SQL * more script contains ON SET ECHO ON and PUT your COMMENTS.

    But in the logfile (see below), I don't see every ALTER DATABASE DATAFILE... command printing. I see that ' altered database.'  printing messages.

    I executed the script to nohup as

    nohup resize.sh > MyResize2.log &

    $ cat MyResize2.log

    DataFile resize started at Sun Dec 29 00:09:45 MYT 2013

    SQL * more: Production of the 11.2.0.4.0 on Sun Dec 29 00:09:45 version 2013

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

    Connected to:

    Oracle Database 11 g Enterprise Edition Release 11.2.0.4.0 - 64 bit Production

    With partitioning, Real Application Clusters, Automatic Storage Management, OLAP,.

    Options of Data Mining and Real Application Testing

    SQL > SQL > SQL > SQL > SQL >

    Database altered.

    SQL >

    Database altered.

    SQL >

    Database altered.

    SQL >

    Database altered.

    SQL >

    Database altered.

    SQL >

    Database altered.

    SQL >

    Database altered.

    Hello

    ECHO applies only to the SQL commands * Plus reads through the @ or the STARTUP command, no statements you type directly in the SQL > prompt or read the bash script statements.

    Try to create a separate file, containing only the command ALTER DATABASE in a separate file (let's call it alter_database.sql for now) and call it from your script bash, like this:

    #! / bin/bash

    export ORACLE_SID = ORCL1

    echo "resize Datafile began to" 'date '.

    sqlplus "/ as sysdba".<>

    set echo on

    Set of feedback on

    @whatever/alter_database

    quit smoking

    EXPRESSIONS OF FOLKLORE

    echo "resize Datafile ended in" 'date '.

  • 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?)

  • PLS-00201 error occurs when the batch a stored procedure in SQL * more

    I have a batch file to run a stored procedure and the coil results in file. When I enter orders manually in sql * plus the output works very well and my results are spooling in the output file. But when I run the same commands in the script I get an error batch.


    Any ideas?

    Stored procedure:

    create or replace procedure MMP (p_cursor in the SYS_REFCURSOR)

    as

    Start

    Open p_cursorfor select name, id from table;

    end;

    batch file 1:

    sqlplus-s user/pw@REPORTDV @sp_output_spooled.sql

    sp_output_spooled.SQL script file

    Paste these commands directly on the SQL * more guest wraps the result as expected the value leader.

    the colsep value ' |'

    trigger the echo

    Set feedback off

    termout off Set

    set the position

    set linesize 9000

    set pagesize 0

    Set trimspool on

    headsep off Set

    output of the coil. TXT

    var refcursor rc

    run MMP(:rc)

    print the rc

    spool off

    output

    Errors printed to the output. TXT file after the batch is executed and error occurs:

    BEGIN MMP(:rc); END;

    *
    ERROR on line 1:
    ORA-06550: line 1, column 8:
    PLS-00201: identifier 'MMP' must be declared.
    ORA-06550: line 1, column 8:
    PL/SQL: Statement ignored


    ERROR:
    ORA-24338: statement handle not executed


    SP2-0625: variable printing error "rc".

    Hello

    Your code worked fine for me.

    Procedure MMP is owned by the same user that runs the batch file or does it means and appropriate privileges?

    VR,

    Sudhakar

  • 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

  • Problem to generate Java package PL SQL in Jdeveloper

    Hello

    I have problem to create the java class package PL SQL in JDeveloper.

    I use jdeveloper database navigator and right-click on a package and choose generate Java then in the Jpublisher window choose my controller view and accept other default values.

    I call methods in the generated class in the Action of a button in my JSP page, but when I click the button it throws null pointer exception! I Fund one of the generated method return null and it lead to this exception.

    protected DefaultContext __tx = null;

    public DefaultContext getConnectionContext() throws SQLException {}

    If (__tx == null) {}

    __tx = (getConnection () == null)? DefaultContext.getDefaultContext (): new DefaultContext (getConnection ());

    }

    Return __tx;

    };

    public connection getConnection() throws SQLException

    {

    If (__onn! = null) return __onn;

    ElseIf (__tx! = null) return __tx.getConnection ();

    ElseIf (__dataSource! = null) __onn = __dataSource.getConnection ();

    Return __onn;

    }

    I'm trying to generate the class in the model project and create DataControl to it and use the action method, but noting the change and I get null pointer again!

    JDeveloper Versino = 11.1.1.7.0

    I would like to ask you another question: why generate java packaging at all?

    Where you want to call the package?

    Back to your question: you should see the code as

    Public Sub setDataSourceLocation (String dataSourceLocation) throws SQLException {}

    javax.sql.DataSource dataSource;

    try {}

    Class cls = Class.forName ("javax.naming.InitialContext");

    Object ctx = cls.newInstance ();

    Meth java.lang.reflect.Method is CL. GetMethod ("search", new class [] {String.class});

    dataSource = (javax.sql.DataSource) meth.invoke (ctx, new Object() {"java: comp/env /" + dataSourceLocation});

    setDataSource (dataSource);

    } catch (Exception e) {}

    again throw java.sql.SQLException ("data source initialization error in" + dataSourceLocation + ":" + e.getMessage ());

    }

    }

    in the generated code. This code search a data source (that you have defined for example on the Weblogic Server) by calling the method

    setDataSourceLocaltion("jdbc/HRConnDS");

    That look to the top of the n data source stores in the class variable.

    Timo

Maybe you are looking for

  • Why firefox crashes on many web sites

    Firefox hangs at 100% on espn.com and several other sites, it seemed to happen after an update of flash. The use of the Mozilla site, I checked the plug-ins, and he said: everything is up-to-date or it says unknown on some plug-ins which I don't use.

  • Re: HARD drive recovery Procedure

    Hello, I need to restore my Toshiba Satellite L650 friends labtop using the restored image of factury software on the HARD disk, the question is should I multi drives this operation? He can't find any CD/DVD probably provided with its labtop, so I wo

  • Motorola. Please answer this question of Lollipop

    Please do not close or block this thread until someone from Motorola it responds. Please give an answer to this question p. Pure Edition Moto X 2014 owners should expect carriers to send lollipop before Motorola will be? Thank you A SUPER FRUSTRATED

  • ORA-16086: Redo data cannot be written in the expectation of recovery log redo

    HelloI have enough disk space: 85% full on both servers, v$ flash_recovery_area_usage shows 56% of the area of dest used recovery.So after checking that I have matching sizes for standby records and logs and check that there is enough space allocated

  • Color tint in highlights

    HelloI was wondering how I could create a tinted color effect in my highlights and create the same non-destructive effect, you can receive the new color settings and cam VSCO in Instagram in Photoshop. I know how to create a tint in Photoshop, but al