Problem of scott grant

Hello

I gave sysdba privilege to scott as below...

grant sysdba to scott;

but the following query does not when I run with the user scott. error "ora - 00942:table is not output.

SELECT master
directory_name,
DIRECTORY_PATH
OF dba_directories;


SELECT d.directory_name,
p.Grantee,
p.Privilege
Dba_directories d,
dba_tab_privs p
WHERE d.directory_name = p.table_name
ORDER
BY directory_name.
beneficiary,
privilege;

Please tell me where I'm wrong sysdba privileges to scott user m...

The SYSDBA (and SYSOPER) are special administrative privileges that allow an administrator to perform basic database administration tasks, such as the creation of the database and start the instance and judgment.

By the granting of these privileges, the user does not automatically receive access to data dictionary views. I think it's what you expected.

You must SELECT privilege to interview these views of data dictionary:

dba_directories
dba_tab_priv

Connect as SYS and to do this:

grant select on dba_directories, dba_tab_priv to scott

In addition, you grant select_catalog_role GOLD select any dictionary to your user of your choice.

SELECT_CATALOG_ROLE role allows you to select the views of catalog (% s/n, v$ %...). If you can grant this role to your user of your choice.

privilege select any dictionary allows allows you to select tables dictionary which is tables sys.
You cannot select tables sys with only select_catalog_role role.

Tags: Database

Similar Questions

  • Grant execute on DBMS_REPUTIL fails

    Hello

    I just installed Oracle Database 11 g Release 11.2.0.4.0 - 64 bit Production, and I need to run on DBMS_REPUTIL of user for the compatibility of the trigger. I get the error:

    SQL > GRANT EXECUTE ON DBMS_REPUTIL to THE PUBLIC;

    GRANT EXECUTE ON DBMS_REPUTIL TO THE PUBLIC

    *

    ERROR on line 1:

    ORA-00942: table or view does not exist

    SQL > grant execute on DBMS_REPUTIL to webusr

    *

    ERROR on line 1:

    ORA-00942: table or view does not exist

    What is the problem with the grant command? Can anyone suggest how to grant execute on this package?

    Here is my version of oracle:

    SQL > select * from v version $;

    BANNER

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

    Oracle Database 11 g Release 11.2.0.4.0 - 64 bit Production

    PL/SQL Release 11.2.0.4.0 - Production

    CORE Production 11.2.0.4.0

    AMT for Linux: Version 11.2.0.4.0 - Production

    NLSRTL Version 11.2.0.4.0 - Production

    Thank you!

    USER issuing the GRANT doesn't have a necessary privilege.

    SQL > connect scott/tiger

    Connected.

    SQL > GRANT EXECUTE ON DBMS_REPUTIL TO THE PUBLIC;

    GRANT EXECUTE ON DBMS_REPUTIL TO THE PUBLIC

    *

    ERROR on line 1:

    ORA-01031: insufficient privileges

    SQL > connect / as sysdba

    Connected.

    SQL > GRANT EXECUTE ON DBMS_REPUTIL TO THE PUBLIC;

    Grant succeeded.

  • Rapid DDL for table - generated 3 times grants

    Developer SQL version 3.2.20.09

    The table is created as follows:
    create table test_quick_ddl
    (
      column1 varchar2(10 char),
      column2 varchar2(10 char)
    );
    
    grant select, update, insert, delete on test_quick_ddl to scott;
    And "the fast DDL" generated for this table looks like:
    --------------------------------------------------------
    --  DDL for Table TEST_QUICK_DDL
    --------------------------------------------------------
    
      CREATE TABLE "KTRM"."TEST_QUICK_DDL" 
       (     "COLUMN1" VARCHAR2(10 CHAR), 
         "COLUMN2" VARCHAR2(10 CHAR)
       ) SEGMENT CREATION DEFERRED 
      PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS NOLOGGING
      TABLESPACE "KTRM" ;
      GRANT DELETE, INSERT, SELECT, UPDATE ON "KTRM"."TEST_QUICK_DDL" TO "SCOTT";
    GRANT DELETE, INSERT, SELECT, UPDATE ON "KTRM"."TEST_QUICK_DDL" TO "SCOTT";
    GRANT DELETE, INSERT, SELECT, UPDATE ON "KTRM"."TEST_QUICK_DDL" TO "SCOTT";

    Hello world
    Thanks for your efforts to report/reproduce the problem.

    I am able to reproduce the problem and identified the cause of it. Working on a fix for it now.

    Joyce Scapicchio
    Team SQLDeveloper

    Published by: Joyce Scapicchio on November 29, 2012 12:57

  • Facing many problems on the creation of directory and an external Table

    Question:

    The strange thing is that if you look at the question 10-b page 3-41, it says:
    (page 3-41 "Oracle Database 10g SQL Fund. II Vol.1")

    Merge the data into the EMP_DATA table that is created in the lab last in the data in the table emp_hist. assume
    EMP_DATA external table data corresponds to the EMP_HIST of table, update the email column
    table EMP_HIST to match the row in the EMP_DATA table. If a row in the EMP_DATA table is not
    match, to be inserted in the tables of EMP_HIST lines are considered as corresponding whenever his first and
    family name are the same.

    For me, this issue is built wrong. First of all in the last lab we have not been asked to create EMP_DATA. Secondly, EMP_DATA is empty.
    Thirdly, this question asks us to merge into the table EMP_HIST while EMP_DATA is empty.

    Table EMP_HIST currently copied data from the employees table. Structure EMP_HIST:

    FIRST NAME VARCHAR2 (20)
    LAST_NAME NOT NULL VARCHAR2 (25)
    EMAIL NOT NULL VARCHAR2 (45)

    Anway, I did the merger as follows:

    merge into e emp_hist
    with the help of emp_data d
    on (e.first_name = d.first_name)
    When matched then
    game update
    Select = d.last_name,
    e.email = d.email
    When not matched then
    Insert values (d.first_name, d.last_name, d.email);

    I get this error:

    Error report:
    SQL error: ORA-29913: error in executing ODCIEXTTABLEOPEN legend
    ORA-29400: data cartridge error
    KUP-04040: file emp.dat in EMP_DIR not found
    ORA-06512: at "SYS." ORACLE_LOADER', line 19
    29913 00000 - "error in the execution of %s legend".
    * Cause: The execution of the specified legend caused an error.
    * Action: Examine the error messages take appropriate measures.

    On the other hand, I said I'm going to try this:

    merge into emp_data d
    using e emp_hist
    on (d.first_name = e.first_name)
    When matched then
    game update
    d.last_name = select,
    d.email = e.email
    When not matched then
    Insert values (e.first_name, select, e.email);

    I get this error because the external table is final once its creation is as far as I know:

    Error report:
    SQL error: ORA-30657: operation not supported on external organized table
    30657.0000 - "operation not supported on external-organized table".
    * Cause: User attempted on the operation on an external table which is
    not supported.
    * Action: Don't do that!

    **********************************

    I don't know what to do. I did my best, please help.

    Published by: user11164565 on July 27, 2009 02:43

    user11164565 wrote:
    NOTE: I did my best, I've done everything I can do, but the problem persists. Help, please

    I'll mention all the steps that I made it clear...

    I gave scott the following grants:

    grant create any directory Scott;
    grant read on the directory emp_dir to scott;

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

    1. create a directory and its been created successfully:

    create or replace directory emp_dir
    like 'F:\emp_dir ';

    Then I made just to make sure that my directory is recognized the following:

    SELECT *.
    OF dba_directories;

    I found the drive among the results...

    OWNER NOM_REPERTOIRE
    ------------------------------ ------------------------------
    DIRECTORY_PATH
    --------------------------------------------------------------------------------
    SYS EMP_DIR
    F:\emp_dir

    SYS SUBDIR
    D:\oracle\product\10.2.0\db_1\demo\schema\order_entry\/2002/Sep

    SYS XMLDIR
    D:\oracle\product\10.2.0\db_1\demo\schema\order_entry\

    ----------------------
    2. I created an external table emp_data (the script is given by the text book): successfully done

    drop table emp_data;

    CREATE TABLE emp_data
    (first name VARCHAR2 (20))
    , last_name VARCHAR2 (20)
    , email VARCHAR2 (30)
    )
    EXTERNAL ORGANIZATION
    (
    TYPE oracle_loader
    Emp_dir default DIRECTORY
    ACCESS SETTINGS
    (
    RECORDS DELIMITED BY NEWLINE CHARACTERSET US7ASCII
    NOBADFILE
    NOLOGFILE
    FIELDS
    (first name POSITION (01:20) TANK)


    , last_name POSITION (22:41) TANK
    CHAR POSITION (43:72) by email)
    )
    LOCATION ('emp.dat'));

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

    3. I went to drive F:\ to see if emp_dir file exist or not! I did not see it. I checked the files hidden, nothing. Anyway, I ignored and did step 4.

    "Anyway, I ignored him... "

    and so the rest of your problems. I do not see in the steps you told that acually you created a directory ("folder") named "\emp_dir" on your f: drive. Anything that you create the database will actually create this directory on the operating system. Uttering a directory in Oracle, uttering an external table in Oracle, don't create pointers to Oracle objects will assume just actually exists.

  • problem sending mail

    Hi all

    I use Oracle database 11g. I'm trying to send emails from gmail to yahoo mail. It is to show

    ORA-29278 transient error smtp 421 service not available.

    Please check my code and suggest me what I do wrong.


    Here I write my email related issue of Oracle 11 g db where sender is a gmail id and beneficiary is yahoo id.

    The whole procedure, the acl created successfully, telnet is also running.

    The value of the parameter, smtp_out_server:

    SMTP.Bizmail.yahoo.com:465 (for yahoo)

    SMTP.gmail.com:465 (for the gmail client).

    I use smtp.gmail.com as my sender is gmail.port:465

    Code:

    sys login:

    GRANT CREATE PROCEDURE, DROP ANY PROCEDURE to scott;
    GRANT EXECUTE ON UTL_TCP TO scott;
    GRANT EXECUTE ON UTL_SMTP to scott;
    GRANT EXECUTE ON UTL_MAIL TO scott;
    GRANT EXECUTE ON DBMS_NETWORK_ACL_ADMIN TO scott;

    SQL > alter system set smtp_out_server = 'smtp.gmail.com:465' scope = spfile
    2;

    Modified system.

    ACL created in the user scott:

    steps of the ACL:

    =======

    Start
    DBMS_NETWORK_ACL_ADMIN. (CREATE_ACL)
    ACL = > "utlmailpkg.xml"
    Description = > "Normal access"
    Main = > 'scott ',.
    Is_Grant = > True, privilege = > 'connection ',.
    Start_date = > Null,
    End_date = > Null);
    End;
    /


    Add privileges to resolve hosts

    Start
    DBMS_NETWORK_ACL_ADMIN. ADD_PRIVILEGE (LCD = > 'utlmailpkg.xml',)
    main = > 'scott ',.
    IS_GRANT = > true,
    privilege = > 'address');
    end;

    Assign ACL to host

    Start
    (DBMS_NETWORK_ACL_ADMIN). ASSIGN_ACL
    ACL = > "utlmailpkg.xml"
    Home = > "smtp.gmail.com", the value of the smtp server.
    lower_port = > 465,
    upper_port = > NULL);
    end;

    -created ACLs successfully

    procedure for utl_smtp for user scott:

    CREATE OR REPLACE PROCEDURE send_mail (p_to IN VARCHAR2,
    P_FROM IN VARCHAR2,
    p_message IN VARCHAR2,
    p_smtp_host IN VARCHAR2,
    p_smtp_port in DEFAULT NUMBER 465)
    AS
    l_mail_conn UTL_SMTP.connection;
    BEGIN
    l_mail_conn: = UTL_SMTP.open_connection (p_smtp_host, p_smtp_port);
    UTL_SMTP. HELO (l_mail_conn, p_smtp_host);
    UTL_SMTP.mail (l_mail_conn, p_from);
    UTL_SMTP. RCPT (l_mail_conn, p_to);
    UTL_SMTP. Data (l_mail_conn, p_message |) UTL_TCP. CRLF. UTL_TCP. CRLF);
    UTL_SMTP. Quit (l_mail_conn);
    END;
    /
    -procedure created successfully

    -When I call the procedure it showing

    ORA-29278 transient error smtp 421 service not available.

    exec send_mail)

        p_to => ' [email protected] ',

    P_from = > ' [email protected] ',

    p_message = > 'test mail ',.

    p_smtp_host = > 'glhq_sudeshna' - name of local host machine

    p_smtp_port = > 465);

    -error


    Thanks and greetings

    Soline

    You must be able to communicate with an SMTP server of your Oracle Server (using well-known port 25 in general).

    You can test the connectivity of your Oracle server using telnet. See if the following command generates a connection (type QUIT to exit the SMTP server session) for example on the Oracle server:

    Telnet mailserver 25

    The 2nd important point is that the SMTP server must be prepared to accept messages from your Oracle server. Relay is very rarely supported.

  • Grants.gov tells me to use the drive 11.0.2. It does not exist. Please tell me I'm not crazy.

    I am about to submit a federal grant through grants.gov.

    On their site, they list Adobe Reader "11.0.2" compatible. In fact, they LINK to the page where it is clear that there is not. 11.0.07 is the latest rev.

    I think they mean 11.0.02. It is very good. I can use it. But we had SO many problems on previous grants through this website, I want to assure you that I'm just following their instructions to the letter. I want to confirm that 11.0.02 is the correct version.

    By sending an e-mail, and speaking with their customer support dept, they literally claim 11.0.2 exists, and that I should contact Adobe. This forum is my only option.

    It is the site where 99% of federal grants are submitted, is not that great.

    Thank you for your help.

    It's the full version of the updates of the player: http://www.adobe.com/support/downloads/product.jsp?product=10&platform=Windows

    There is no drive 11.0.2.

  • grant the select privilege on the table in another schema by role error

    Hello
    I have a problem with the granting of privileges to another schema
    I have A user who has only 1 system priv: connect, which has a private: create session;
    I created a role X, which I have the privilege: select on a table to a diagram B customer.
    I then conceded this X role to A user.
    I can't select * B.customers when im connected to A
    identification of information like it that I'm missing?
    Thank you
    Rgds

    >
    but whenever I put a default role, the other is automatically set to zero-defects

    How did you receive the two default roles?
    >
    By running the code I posted above as user SYS.

    Drop your user and start again and use the code I posted.

  • create new user similar to scott

    Hello
    I want to create a user with the same roles that the user scott. I am unable to find any specific role assigned to the user scott that I can attribute to my new user. Any help?

    Thank you
    Ashish
    conn scott/tiger
    
    SELECT * FROM user_role_privs;
    

    So my advice is to forget about the result of the query and the specific system privileges you actually need. These roles are for demonstration purposes and should not be used or relied upon. I guess that the following would be sufficient.

    SELECT DISTINCT object_type
    FROM dba_objects
    WHERE owner = 'SCOTT';
    
    GRANT create session TO ;
    GRANT create table TO ;
    
  • Audit level diagram 11g R2

    People,

    Please, consider the scenario.


    We have a user named 'TEST '. We granted SELECT privileges to test user on 'SCOTT. DEPT. I can ask questions without any problem to SCOTT. Table of DEPT by connecting with the TEST user.

    Then, I enable auditing as follows:

    SQL > AUDIT ALL OF test BY ACCESS;
    SQL > AUDIT SELECT TABLE, TABLE UPDATE, INSERT a TABLE, ALTER TABLE, DELETE TABLE TEST BY ACCESS;
    SQL > AUDIT PROCEDURE of EXECUTION OF test ACCESS;

    Audit is now working for the TEST user and give me the correct results when never say user TEST query any object within its own schema.


    The problem is that audit tables unable to provide cross access schema information. As if I have the query:


    SELECT * from the Department;

    The statement is, but while performing a query even compared to the SCOTT schema:

    SELECT * from scott.dept;


    It won't save any audit record, and we want to capture it.


    Need your suggestions here.


    Kind regards

    Ali

    He probably does.

    SQL > drop user audtest waterfall;

    Deleted user.

    SQL > create user audtest identified by audtest;

    Created by the user.

    SQL > grant connect to audtest;

    Total grant.

    SQL > grant select on tt.dept to audtest;

    Total grant.

    SQL > select table of audit by audtest;

    Full check.

    SQL > conn audtest/audtest @...

    Connected.

    SQL > select * from tt.dept;

    ID

    ----------

    10

    SQL > select username, timestamp, owner, obj_name, action of dba_audit_trail where username = 'AUDTEST' and owner is "TT";

    USERNAME OWNER OF TIMESTAMP OBJ_NAME ACTION

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

    AUDTEST FEBRUARY 3-16 TT DEPT 103

    1 selected line.

  • Large table must be moved schema

    Hi guru Oracle

    IM using AIX 5.3 with oracle 11.2.0.2

    I just finished a job where I took a LOW partition of a partitioned table on our production database and installs all the data table into its own not partitioned our database archive.  This table on Archive is 1.5 to.

    Just to give you a brief overview of what I've done, successfully:

    -Created a partition no table on Production with exactly the same structure as the partitioned table set apart from the partitions.  Then, I moved all the subject segments in the same tablespace as the table to make it TRANSPORTABLE.

    -J' then took an expdp of the metadata tables by using the transport_tablespaces parameter.

    -Take the tablespace to read write I used the cp command to transfer the data files to the new directory.

    -Then on the database to ARCHIVE, I used impdp to import metadata and direct them to new files.

    parfile =

    DIRECTORY = DATA_PUMP_DIR

    DUMPFILE = dumpfile.dmp

    LOGFILE logfile.log =

    REMAP_SCHEMA = schema1:schema2

    DB11G = "xx", "xx", "xx"...

    My problem now is that there is some confusion and I traced the wrong schema, this isn't a major problem, but I wouldn't like to groom, so instead of saying REMAP_SCHEMA = schema1:schema2 must be REMAP_SCHEMA = schema1:schema3

    To the question: what is the best way to occupy the table schema3 (1.5 to in scheam2).


    To the question: what is the best way to occupy the table schema3 (1.5 to in scheam2).

    The easiest way is to use EXCHANGE PARTITTION to just 'swap' in the segment.

    You can only 'swap' between a partitioned table and a non-partitioned table, and you already have a non-partitioned table.

    So, create a table that is partitioned with a score in the new schema and table not partitioned in the same pattern again.

    Then exchange the old schema with the partition table in the new schema. Then share this new partition with the new table not partitioned in the new scheme. No data should move at all - just a data dictionary operation.

    Using patterns HR and SCOTT. Suppose you have a copy of the EMP table in SCOTT that you want to move to HR.

    - as SCOTT
    grant all on emp_copy HR

    - as HR

    CREATE TABLE EMP_COPY AS SELECT * FROM SCOTT. EMP_COPY WHERE 1 = 0;

    -create a partitioned temp table with the same structure as the table
    CREATE TABLE EMP_COPY_PART
    PARTITION OF RANGE (empno)
    (partition ALL_DATA values less than (MAXVALUE)
    )
    AS SELECT * FROM EMP_COPY;

    -the Bazaar in the segment of the table - very fast
    ALTER TABLE EXCHANGE PARTITION ALL_DATA EMP_COPY_PART TABLE SCOTT. EMP_COPY;

    -now share again in the target table
    ALTER TABLE EXCHANGE PARTITION ALL_DATA WITH TABLE EMP_COPY EMP_COPY_PART;

  • get the unwanted letters instead of the picture in an e-mail message.

    Hi all


    I try to send a mail via gmail.com that I am able to send mail, but when I try
    Send an attachment so I get strange text instead of the picture
    his photo not showing but it is different in shape text appears in my Inbox.
    Here is the result.
    also get this error but I am able to send e-mail.
    ERROR at line 1:
    ORA-20000: Failed to send mail due to the
    following error: ORA-29277: invalid SMTP operation
    ORA-06512: at "MAIL.MAHI", line 159
    ORA-06512: at line 2
    ===============================================
    --BACKUP.SECBOUNDContent-
    Type: application/octet-streamContent-Disposition:
     attachment; filename="g.gif"Content-Transfer-Encoding: base64 
    Qk2O5QgAAAAAADYAAAAoAAAAwgIAABMBAAABABgAAAAA
    AFjlCAAAAAAAAAAAAAAAAAAAAAAAhNWuhNWuhNWuhNWu
    hNWuhNWuhNWuhNWuhNWuhNWuhNWuhNWuhNWuhNWuh
    NWuhNWuhNWuhNWuhNWuhNWuhNWuhNWuhNWuhNWuhNW
    uhNWuhNWuhNWuhNWuhNWuhNWuhNWuhNWuhNWuhNWuhN
    WuhNWuhNWuhNWuhNWuhNWuhNWuhNWuhNWuhNWuhNWuh
    NWuhNWuhNWuhNWuhNWuhNWuhNWuhNWuhNWuhNWuhNWu
    hNWuhNWuhNWuhNWuhNWuhNWuhNWuhN
    WuhNWuhNWuhNWuhNWuhNWuhNWuhNWuhNWuhNWuhNWuh
    NWuhNWuhNWuhNWuhNWuhNWuhNWuhNWuhNWuhNWuhNW
    uhNWuhNWuhNWuhNWuhNWuhNWuhNWuhNWuhNWuhNWuhN
    WuhNWuhNWuhNWuhNWuhNWuhNWuhNWuhNWuhNWuhNWuhN
    and here the link that I followed to use with my codes...
    Re: Sending a message UTL_SMTP collateral issue unique jpg
    create or replace package body Mahi
           is
              -- Write a MIME header
              procedure write_mime_header (
                  p_conn in out nocopy utl_smtp.connection
               , p_name in varchar2
                , p_value in varchar2
              )
               is
              begin
                utl_smtp.write_data ( p_conn
                                     , p_name || ': ' || p_value || utl_tcp.crlf
                 );
             end;
             procedure mail (
                p_sender in varchar2
              , p_recipient in varchar2
               , p_subject in varchar2
               , p_message in varchar2
              )
              is
                l_conn           utl_smtp.connection;
                nls_charset    varchar2(255);
               v_src_loc  BFILE := BFILENAME('BACKUP', 'Logon.jpg');
               --v_src_loc BLOB;
          l_buffer   RAW(54);
          l_amount   BINARY_INTEGER := 54;
          l_pos      INTEGER := 1;
          l_blob     BLOB := EMPTY_BLOB;
          l_blob_len INTEGER;
         v_amount   INTEGER;
                  v_fname VARCHAR2(50);
    
         CURSOR img_cur IS SELECT photo_name,photo
      FROM temp_photo;
     
    
        --crlf  varchar2(2) := chr(10)||chr(13);
    
    PROCEDURE send_header(pi_name IN VARCHAR2, pi_header IN VARCHAR2) AS
       BEGIN
          UTL_SMTP.WRITE_DATA(l_conn,
                              pi_name || ': ' || pi_header || UTL_TCP.CRLF);
       END;
    
             begin
                -- get characterset
                select value
                into   nls_charset
                from   nls_database_parameters
                where  parameter = 'NLS_CHARACTERSET';
                /*
                select 
                photo into v_src_loc from
                temp_photo
                where id=1;
                */
                DBMS_LOB.OPEN(v_src_loc, DBMS_LOB.LOB_READONLY); --Read the file
         DBMS_LOB.CREATETEMPORARY(l_blob, TRUE); --Create temporary LOB to store the file.
         v_amount := DBMS_LOB.GETLENGTH(v_src_loc); --Amount to store.
         DBMS_LOB.LOADFROMFILE(l_blob, v_src_loc, v_amount); -- Loading from file into temporary LOB
         --DBMS_LOB.COPY(l_blob, v_src_loc, v_amount);
         l_blob_len := DBMS_LOB.getlength(l_blob);
     
               -- establish connection and autheticate
               l_conn   := utl_smtp.open_connection (g_smtp_host, g_smtp_port);
                utl_smtp.ehlo(l_conn, g_smtp_domain);
                 utl_smtp.command(l_conn, 'auth login');
                 utl_smtp.command(l_conn,utl_encode.text_encode('[email protected]', nls_charset, 1));
                utl_smtp.command(l_conn, utl_encode.text_encode('xxxxx', nls_charset, 1));
                 -- set from/recipient
                  utl_smtp.command(l_conn, 'MAIL FROM: <'||p_sender||'>');
                 utl_smtp.command(l_conn, 'RCPT TO: <'||p_recipient||'>');
                -- write mime headers
                 utl_smtp.open_data (l_conn);
                 write_mime_header (l_conn, 'From', p_sender);
                write_mime_header (l_conn, 'To', p_recipient);
                write_mime_header (l_conn, 'Subject', p_subject);
                 write_mime_header (l_conn, 'Content-Type', 'text/plain; charset=us-ascii');
                 write_mime_header (l_conn, 'X-Mailer', g_mailer_id);
                 utl_smtp.write_data (l_conn, UTL_TCP.CRLF);
                 UTL_SMTP.WRITE_DATA(l_conn,
                             'MIME-Version: 1.0' || UTL_TCP.CRLF);
         UTL_SMTP.WRITE_DATA(l_conn,
                             'Content-Type: multipart/mixed; ' || UTL_TCP.CRLF);
         UTL_SMTP.WRITE_DATA(l_conn,
                             ' boundary= "' || 'BACKUP.SECBOUND' || '"' ||
                             UTL_TCP.CRLF);
         UTL_SMTP.WRITE_DATA(l_conn, UTL_TCP.CRLF);
       
     
                 -- write message body
                utl_smtp.write_data (l_conn, p_message);
                OPEN img_cur;
      LOOP
      FETCH img_cur INTO v_fname,l_blob;
    end loop;
    close img_cur;
                
                UTL_SMTP.WRITE_DATA(l_conn,
                             '--' || 'BACKUP.SECBOUND' || UTL_TCP.CRLF);
         UTL_SMTP.WRITE_DATA(l_conn,
                             'Content-Type: text/plain;' || UTL_TCP.CRLF);
         UTL_SMTP.WRITE_DATA(l_conn,
                             ' charset=US-ASCII' || UTL_TCP.CRLF);
         UTL_SMTP.WRITE_DATA(l_conn, UTL_TCP.CRLF);
         UTL_SMTP.WRITE_DATA(l_conn,  p_message || UTL_TCP.CRLF);
         UTL_SMTP.WRITE_DATA(l_conn, UTL_TCP.CRLF);
         
         UTL_SMTP.WRITE_DATA(l_conn,
                             '--' || 'BACKUP.SECBOUND' || UTL_TCP.CRLF);
         UTL_SMTP.WRITE_DATA(l_conn,
                             'Content-Type: application/octet-stream' ||
                             UTL_TCP.CRLF);
         UTL_SMTP.WRITE_DATA(l_conn,
                             'Content-Disposition: attachment; ' || UTL_TCP.CRLF);
         UTL_SMTP.WRITE_DATA(l_conn,
                             ' filename="' || 'gpg.jpg' || '"' || --My filename
                             UTL_TCP.CRLF);
         UTL_SMTP.WRITE_DATA(l_conn,
                             'Content-Transfer-Encoding: base64' || UTL_TCP.CRLF);
        UTL_SMTP.WRITE_DATA(l_conn, UTL_TCP.CRLF);
      /* Writing the BLOL in chunks */
        WHILE l_pos < l_blob_len LOOP
          DBMS_LOB.READ(l_blob, l_amount, l_pos, l_buffer);
          UTL_SMTP.write_raw_data(l_conn,
                                  UTL_ENCODE.BASE64_ENCODE(l_buffer));
          UTL_SMTP.WRITE_DATA(l_conn, UTL_TCP.CRLF);
           l_buffer := NULL;
           l_pos    := l_pos + l_amount;
         END LOOP;
         UTL_SMTP.WRITE_DATA(l_conn, UTL_TCP.CRLF);
       
        -- Close Email
        UTL_SMTP.WRITE_DATA(l_conn,
                             '--' || 'BACKUP.SECBOUND' || '--' || UTL_TCP.CRLF);
         UTL_SMTP.WRITE_DATA(l_conn,
                             UTL_TCP.CRLF || '.' || UTL_TCP.CRLF);
                             UTL_SMTP.CLOSE_DATA(l_conn);
                             utl_smtp.close_data (l_conn);
         UTL_SMTP.QUIT(l_conn);
         DBMS_LOB.FREETEMPORARY(l_blob);
         DBMS_LOB.FREETEMPORARY(l_blob);
         DBMS_LOB.FILECLOSE(v_src_loc);
     
                    -- end connection
                utl_smtp.quit (l_conn);
                        exception
                 when others
                 then
                   begin
                      utl_smtp.quit(l_conn);
                    exception
                      when others then
                       null;
                   end;
                   
                   raise_application_error(-20000,'Failed to send mail due to the
     following error: ' || sqlerrm);
     DBMS_LOB.FREETEMPORARY(l_blob);
     DBMS_LOB.FREETEMPORARY(l_blob);
          DBMS_LOB.FILECLOSE(v_src_loc);
         raise;
             end;
          end;
          commit;
    Note:-I am using Stunnel, Oracle Database 11g R2 and operating system is Linux...
    I have installed Linux on virtualBox.


    Please suggest me why I get a strange text instead of the picture?
    If my code is wrong, please fix it for me...
    Thanks in advance...

    Tic Tac Toe
    Student.

    Published by: Johann April 15, 2011 22:57

    The main problem is, you have not specified clearly what you are doing and also not a not post your package specifications. After looking more closely at your code, I found that you use gmail.smtp.com and probably with stunnel (UTL_SMTP supports SSL).
    In addition, the main idea is to http://monkeyonoracle.blogspot.com/2009/11/plsql-and-gmail-or-utlsmtp-with-ssl.html
    If you would like to mention these facts, then probably someone can help you more sooner. In any case, it is an example of work of sending e-mail by using the gmail SMTP server.

    SQL> conn sys@orclsb as sysdba
    Enter password: ******
    Connected.
    SQL>
    SQL> SHOW USER
    USER is "SYS"
    SQL>
    SQL> /* My database version */
    SQL> SELECT * FROM v$version;
    
    BANNER
    ----------------------------------------------------------------
    Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - Prod
    PL/SQL Release 10.2.0.3.0 - Production
    CORE    10.2.0.3.0      Production
    TNS for 32-bit Windows: Version 10.2.0.3.0 - Production
    NLSRTL Version 10.2.0.3.0 - Production
    
    SQL> /* Creating DIRECTRY OBJECT. The physical path is C:\ */
    SQL> CREATE DIRECTORY saubhik AS 'C:\';
    
    Directory created.
    
    SQL> /* Giving required grants to user SCOTT */
    SQL> GRANT READ,WRITE ON DIRECTORY saubhik TO scott;
    
    Grant succeeded.
    
    SQL> /* Now connecting to the user scott, to run the emailing procedure */
    SQL> conn scott@orclsb
    Enter password: *****
    Connected.
    SQL>
    SQL> SHOW USER
    USER is "SCOTT"
    SQL>
    SQL> 
    

    Now, the code principal.

    SQL> SHOW USER
    USER is "SCOTT"
    SQL>
    SQL> DECLARE
      2    v_nls_charset VARCHAR2(50);
      3    /*LOB operation related varriables */
      4    v_src_loc  BFILE := BFILENAME('SAUBHIK', 'Winter.jpg');
      5    l_buffer   RAW(54);
      6    l_amount   BINARY_INTEGER := 54;
      7    l_pos      INTEGER := 1;
      8    l_blob     BLOB := EMPTY_BLOB;
      9    l_blob_len INTEGER;
     10    v_amount   INTEGER;
     11
     12    /*UTL_SMTP related varriavles. */
     13    v_connection_handle  UTL_SMTP.CONNECTION;
     14    v_from_email_address VARCHAR2(30) := '[email protected]';
     15    v_to_email_address   VARCHAR2(30) := '[email protected]';
     16    /*
     17     I have used stunnel to send mail using smtp.gmail.com
     18     To get stunnel see http://stunnel.org/.
     19     The ORIGINAL idea is here :
     20     http://monkeyonoracle.blogspot.com/2009/11/plsql-and-gmail-or-utlsmtp-with-ssl.html
     21    */
     22    v_smtp_host          VARCHAR2(30) := 'localhost';
     23    v_subject            VARCHAR2(30) := 'Your Test Mail';
     24    l_message            VARCHAR2(200) := 'This is test mail using UTL_SMTP';
     25
     26    /* This send_header procedure is written in the documentation */
     27    PROCEDURE send_header(pi_name IN VARCHAR2, pi_header IN VARCHAR2) AS
     28    BEGIN
     29      UTL_SMTP.WRITE_DATA(v_connection_handle,
     30                          pi_name || ': ' || pi_header || UTL_TCP.CRLF);
     31    END;
     32
     33  BEGIN
     34
     35    SELECT value
     36      INTO v_nls_charset
     37      FROM nls_database_parameters
     38     WHERE parameter = 'NLS_CHARACTERSET';
     39
     40    /*Preparing the LOB from file for attachment. */
     41    DBMS_LOB.OPEN(v_src_loc, DBMS_LOB.LOB_READONLY); --Read the file
     42    DBMS_LOB.CREATETEMPORARY(l_blob, TRUE); --Create temporary LOB to store the file.
     43    v_amount := DBMS_LOB.GETLENGTH(v_src_loc); --Amount to store.
     44    DBMS_LOB.LOADFROMFILE(l_blob, v_src_loc, v_amount); -- Loading from file into temporary LOB
     45    l_blob_len := DBMS_LOB.getlength(l_blob);
     46
     47    /*UTL_SMTP related coding. */
     48    v_connection_handle := UTL_SMTP.OPEN_CONNECTION(host => v_smtp_host,
     49                                                    port => 1925);
     50    UTL_SMTP.EHLO(v_connection_handle, 'gmail.com');
     51    UTL_SMTP.COMMAND(v_connection_handle, 'auth login');
     52    UTL_SMTP.COMMAND(v_connection_handle,
     53                     UTL_ENCODE.TEXT_ENCODE('[email protected]',
     54                                            v_nls_charset,
     55                                            1));
     56    UTL_SMTP.COMMAND(v_connection_handle,
     57                     UTL_ENCODE.TEXT_ENCODE('my password', v_nls_charset, 1));
     58    --UTL_SMTP.MAIL(v_connection_handle, v_from_email_address);
     59    --UTL_SMTP.RCPT(v_connection_handle, v_to_email_address);
     60    UTL_SMTP.COMMAND(v_connection_handle,
     61                     'MAIL FROM: <' || v_from_email_address || '>');
     62    UTL_SMTP.COMMAND(v_connection_handle,
     63                     'RCPT TO: <' || v_to_email_address || '>');
     64    UTL_SMTP.OPEN_DATA(v_connection_handle);
     65    send_header('From', '"Sender" <' || v_from_email_address || '>');
     66    send_header('To', '"Recipient" <' || v_to_email_address || '>');
     67    send_header('Subject', v_subject);
     68    --MIME header.
     69    UTL_SMTP.WRITE_DATA(v_connection_handle,
     70                        'MIME-Version: 1.0' || UTL_TCP.CRLF);
     71    UTL_SMTP.WRITE_DATA(v_connection_handle,
     72                        'Content-Type: multipart/mixed; ' || UTL_TCP.CRLF);
     73    UTL_SMTP.WRITE_DATA(v_connection_handle,
     74                        ' boundary= "' || 'SAUBHIK.SECBOUND' || '"' ||
     75                        UTL_TCP.CRLF);
     76    UTL_SMTP.WRITE_DATA(v_connection_handle, UTL_TCP.CRLF);
     77
     78    -- Mail Body
     79    UTL_SMTP.WRITE_DATA(v_connection_handle,
     80                        '--' || 'SAUBHIK.SECBOUND' || UTL_TCP.CRLF);
     81    UTL_SMTP.WRITE_DATA(v_connection_handle,
     82                        'Content-Type: text/plain;' || UTL_TCP.CRLF);
     83    UTL_SMTP.WRITE_DATA(v_connection_handle,
     84                        ' charset=US-ASCII' || UTL_TCP.CRLF);
     85    UTL_SMTP.WRITE_DATA(v_connection_handle, UTL_TCP.CRLF);
     86    UTL_SMTP.WRITE_DATA(v_connection_handle, l_message || UTL_TCP.CRLF);
     87    UTL_SMTP.WRITE_DATA(v_connection_handle, UTL_TCP.CRLF);
     88
     89    -- Mail Attachment
     90    UTL_SMTP.WRITE_DATA(v_connection_handle,
     91                        '--' || 'SAUBHIK.SECBOUND' || UTL_TCP.CRLF);
     92    UTL_SMTP.WRITE_DATA(v_connection_handle,
     93                        'Content-Type: application/octet-stream' ||
     94                        UTL_TCP.CRLF);
     95    UTL_SMTP.WRITE_DATA(v_connection_handle,
     96                        'Content-Disposition: attachment; ' || UTL_TCP.CRLF);
     97    UTL_SMTP.WRITE_DATA(v_connection_handle,
     98                        ' filename="' || 'Winter.jpg' || '"' || --My filename
     99                        UTL_TCP.CRLF);
    100    UTL_SMTP.WRITE_DATA(v_connection_handle,
    101                        'Content-Transfer-Encoding: base64' || UTL_TCP.CRLF);
    102    UTL_SMTP.WRITE_DATA(v_connection_handle, UTL_TCP.CRLF);
    103
    104    /* Writing the BLOL in chunks */
    105    WHILE l_pos < l_blob_len LOOP
    106      DBMS_LOB.READ(l_blob, l_amount, l_pos, l_buffer);
    107      UTL_SMTP.write_raw_data(v_connection_handle,
    108                              UTL_ENCODE.BASE64_ENCODE(l_buffer));
    109      UTL_SMTP.WRITE_DATA(v_connection_handle, UTL_TCP.CRLF);
    110      l_buffer := NULL;
    111      l_pos    := l_pos + l_amount;
    112    END LOOP;
    113    UTL_SMTP.WRITE_DATA(v_connection_handle, UTL_TCP.CRLF);
    114
    115    -- Close Email
    116    UTL_SMTP.WRITE_DATA(v_connection_handle,
    117                        '--' || 'SAUBHIK.SECBOUND' || '--' || UTL_TCP.CRLF);
    118    UTL_SMTP.WRITE_DATA(v_connection_handle,
    119                        UTL_TCP.CRLF || '.' || UTL_TCP.CRLF);
    120
    121    UTL_SMTP.CLOSE_DATA(v_connection_handle);
    122    UTL_SMTP.QUIT(v_connection_handle);
    123    DBMS_LOB.FREETEMPORARY(l_blob);
    124    DBMS_LOB.FILECLOSE(v_src_loc);
    125
    126  EXCEPTION
    127    WHEN OTHERS THEN
    128      UTL_SMTP.QUIT(v_connection_handle);
    129      DBMS_LOB.FREETEMPORARY(l_blob);
    130      DBMS_LOB.FILECLOSE(v_src_loc);
    131      RAISE;
    132  END;
    133  /
    
    PL/SQL procedure successfully completed.
    
    SQL> 
    

    I got the email in my email perfectly with the attachment.

  • Privileges of the object. Who is the grantor?

    Nice day.
    Please explain the next issue
    SQL> conn /as sysdba
    Connected.
    SQL> create user test identified by test;
    
    User created.
    
    SQL> create user test1 identified by test;
    
    User created.
    
    SQL> grant resource, connect to test;
    
    Grant succeeded.
    
    SQL> conn test
    Enter password:
    Connected.
    SQL> create table t (x number);
    
    Table created.
    
    SQL> grant select on t to test1;
    
    Grant succeeded.
    
    SQL> conn /as sysdba
    Connected.
    
    SQL> grant select on test.t to scott;
    
    Grant succeeded.
    
    --########################---
    SQL> select * from dba_tab_privs where table_name='T';
    
    GRANTEE    OWNER      TABLE_NAME GRANTOR    PRIVILEGE            GRA HIE
    ---------- ---------- ---------- ---------- -------------------- --- ---
    SCOTT      TEST       T          TEST       SELECT               NO  NO
    TEST1      TEST       T          TEST       SELECT               NO  NO
    
    SQL>
    Suppose that what was previously-#-a black box.
    How can you determine which is issued a grant?

    Apparently, this is the result of change that put oracle implement 9i or 10g (you have not, as most of the users here mention a version, being that it's completely unimportant that Oracle has not changed since its creation).
    Before 9i, only the owner of the table was able to grant privileges. It's a problem with the BEDS and other applications where DBA did not know the password. Either you need to change the password, or to implement a hack.
    Since the 9i SYS can administer grants on behalf of other users.
    The result seems to be that the owner of the object is registered as the grantor.
    So basically: when you assign AUDIT_SYS_OPERATIONS to true, or do not level GRANT, you won't be able to see.

    ------------
    Sybrand Bakker
    Senior Oracle DBA

  • Should I switch from 7.5 to 7.6, or should I wait for version 8.0?

    We are currently running version 7.5.304.547. It is better to upgrade to version 7.6, or should I wait for version 8.0? Is the upgrade from 7.5 to 7.6 painless?

    Hi David,

    There is a fix for the problem mentioned Scott, it's hotfix 217443. Please visit this page on our support site for more details of this and other packages of fixes that have been released for vWorkspace 7.6

    https://support.quest.com/Softwaredownloads.aspx?PR=268445634&PV=4294952544

    Kind regards

    David

  • Errors during download of images in BLOB

    We have Oracle database 11g in our environment. I get errors when downloading image in BLOB. The steps are:

    1) I created the table like:

    CREATE TABLE test_image

    (

    Identification NUMBER, image_filename, VARCHAR2 (50), picture BLOB);

    2) create or replace

    PROCEDURE insert_image_file (p_id NUMBER, p_image_name IN VARCHAR2)

    IS

    src_file BFILE.

    dst_file BLOB;

    Directory of lgh_file;

    BEGIN

    src_file: = BFILENAME ("TEST_DIR", p_image_name);

    -Open the file

    DBMS_LOB. FileOpen (src_file, DBMS_LOB.file_readonly);

    -determine the length

    lgh_file: = DBMS_LOB.getlength (src_file);

    -Read the file

    DBMS_LOB. LoadFromFile (dst_file, src_file, lgh_file);

    -update the blob field

    UPDATE test_image SET image = WHERE ID = p_id AND image_filename dst_file is p_image_name;.

    -close file

    DBMS_LOB. FileClose (src_file);

    END insert_image_file;

    3) I did an insert-insert into test_image values(1,'2.tif',null);

    4) when I call the procedure-

    Insert_image_file(1,'2.tif') EXECUTE, I get errors like:

    Error from line 7 in the command:

    EXECUTE insert_image_file(1,'2.tif')

    Error report:

    ORA-06502: PL/SQL: digital error or value: specified incorrect LOB Locator: ORA-22275

    ORA-06512: at "SYS." DBMS_LOB", line 928

    ORA-06512: at "TEST_REPORT1. INSERT_IMAGE_FILE', line 14

    ORA-06512: at line 1

    06502 00000 - "PL/SQL: digital error or the value of %s.

    * Cause:

    * Action:


    I am not able to understand what goes wrong.

    Ask for a response to my post.

    Concerning

    [oracle@localhost ~]$ ## My Operating System Details.
    [oracle@localhost ~]$ ###############################
    [oracle@localhost ~]$ uname -a
    Linux localhost.localdomain 2.6.18-194.el5 #1 SMP Mon Mar 29 22:10:29 EDT 2010 x86_64 x86_64 x86_64 GNU/Linux
    [oracle@localhost ~]$ cd saubhik/
    [oracle@localhost saubhik]$ pwd
    /home/oracle/saubhik
    [oracle@localhost saubhik]$ ls -l *.jpeg
    -rw-r--r-- 1 oracle oinstall 1336 Mar 27 12:57 oracle1.jpeg
    -rw-r--r-- 1 oracle oinstall 2658 Mar 27 12:57 oracle2.jpeg
    [oracle@localhost saubhik]$ 
    

    Now, of the object directory configurations.

    [oracle@localhost saubhik]$ sqlplus / as sysdba
    
    SQL*Plus: Release 11.2.0.1.0 Production on Fri Mar 27 12:59:52 2015
    
    Copyright (c) 1982, 2009, Oracle.  All rights reserved.
    
    Connected to:
    Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
    With the Partitioning, OLAP, Data Mining and Real Application Testing options
    
    SQL> -- Creating Directory Object.
    SQL> -----------------------------
    SQL> CREATE OR REPLACE DIRECTORY saubhik AS '/home/oracle/saubhik';
    
    Directory created.
    
    SQL> GRANT read, write, execute on DIRECTORY saubhik TO scott;
    
    Grant succeeded.
    
    SQL> 
    

    Now, your tables and procedure.

    [oracle@localhost saubhik]$ sqlplus scott/tiger
    
    SQL*Plus: Release 11.2.0.1.0 Production on Fri Mar 27 13:31:07 2015
    
    Copyright (c) 1982, 2009, Oracle.  All rights reserved.
    
    Connected to:
    Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
    With the Partitioning, OLAP, Data Mining and Real Application Testing options
    
    SQL> --My database version.
    SQL> ---------------------
    SQL> SELECT * FROM v$version;
    
    BANNER
    --------------------------------------------------------------------------------
    Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
    PL/SQL Release 11.2.0.1.0 - Production
    CORE    11.2.0.1.0      Production
    TNS for Linux: Version 11.2.0.1.0 - Production
    NLSRTL Version 11.2.0.1.0 - Production
    
    SQL> DROP TABLE test_image purge;
    
    Table dropped.
    
    SQL> ed
    Wrote file afiedt.buf
    
      1* DROP TABLE test_image purge
    SQL> ed
    Wrote file afiedt.buf
    
      1  CREATE TABLE test_image
      2    (
      3      ID             NUMBER,
      4      image_filename VARCHAR2(50),
      5      image BLOB
      6*   )
    SQL> /
    
    Table created.
    
    SQL> INSERT INTO test_image VALUES (1,'oracle1.jpeg',NULL );
    
    1 row created.
    
    SQL> INSERT INTO test_image VALUES  (2,'oracle2.jpeg',NULL  );
    
    1 row created.
    
    SQL> commit;
    
    Commit complete.
    
    SQL> ed
    Wrote file afiedt.buf
    
      1  create or replace
      2  PROCEDURE insert_image_file
      3    (
      4      p_id NUMBER,
      5      p_image_name IN VARCHAR2
      6    )
      7  IS
      8    src_file BFILE;
      9    dst_file BLOB;
     10    lgh_file number;
     11  BEGIN
     12    -- update the blob field
     13    update test_image
     14    set image=empty_blob()
     15    WHERE ID = p_id AND image_filename = p_image_name
     16    returning image into dst_file
     17    ;
     18    src_file := BFILENAME
     19    (
     20      'SAUBHIK', p_image_name
     21    )
     22    ;
     23    -- open the file
     24    DBMS_LOB.fileopen
     25    (
     26      src_file, DBMS_LOB.file_readonly
     27    )
     28    ;
     29    -- determine length
     30    lgh_file := DBMS_LOB.getlength
     31    (
     32      src_file
     33    )
     34    ;
     35    -- read the file
     36    DBMS_LOB.loadfromfile
     37    (
     38      dst_file, src_file, lgh_file
     39    )
     40    ;
     41    -- close file
     42    DBMS_LOB.fileclose (src_file);
     43    commit;
     44* END insert_image_file;
     45  /
    
    Procedure created.
    
    SQL> ed
    Wrote file afiedt.buf
    
      1  BEGIN
      2    insert_image_file ( 1, 'oracle1.jpeg' );
      3    insert_image_file ( 2, 'oracle2.jpeg' );
      4* END
    SQL> /
    END
      *
    ERROR at line 4:
    ORA-06550: line 4, column 3:
    PLS-00103: Encountered the symbol "end-of-file" when expecting one of the
    following:
    ;  
    The symbol ";" was substituted for "end-of-file" to continue.
    
    SQL> ed
    Wrote file afiedt.buf
    
      1  BEGIN
      2    insert_image_file ( 1, 'oracle1.jpeg' );
      3    insert_image_file ( 2, 'oracle2.jpeg' );
      4* END;
      5  /
    
    PL/SQL procedure successfully completed.
    
    SQL> SELECT id,image_filename,dbms_lob.getlength(image) FROM test_image;
    
            ID IMAGE_FILENAME
    ---------- --------------------------------------------------
    DBMS_LOB.GETLENGTH(IMAGE)
    -------------------------
             1 oracle1.jpeg
                         1336
    
             2 oracle2.jpeg
                         2658
    
    SQL> 
    

    Check the file size with the size of the operating system. They are the same.

  • Join as a Condition

    Hello

    I'd like to get the code from location_lookup table based on a descriptive text of the location_source table, but this would require a join by using a like condition. There are also several research location with unique codes, but the requirement would be to select the first code:

    create the table location_source
    (code number,
    Description varchar2 (100)
    );

    insert into location_source values (", 'visit London');
    insert into location_source values (", 'flight Paris 9,30');
    insert into location_source values (", 'baggage 20kg Hong kong');
    insert into location_source values (", 'check out 6.30');
    insert into location_source values (", 'new york, 23 Jul');
    insert into location_source values (", 'jy688 of flight sydney');

    create the table location_lookup
    (code number
    location_lookup varchar2 (10)
    );

    insert into location_lookup values (001, "London");
    insert into location_lookup values (002, "London");
    insert into location_lookup values (003, 'Paris');
    insert into location_lookup values ('004, Hong Kong");
    insert into location_lookup values (005, 'Paris');
    insert into location_lookup values ('006, New York");

    The SQL looks like this:

    Select s.*, min (l.code), l.location_lookup

    of location_source s, locaction_lookup l

    and SUPERIOR (s.description |) "%') as superior (l.location_lookup |) » %')

    Group of s.*, l.location_lookup

    Power required:

    CodeDescriptionCodeLocation_Lookup
    check in London001London
    Paris 9:30 flight003Paris
    baggage 20kg Hong kong004Hong Kong
    starting at 6:30
    New york 23 Jul006New York City
    flight sydney jy688

    You try to use Oracle Text.

    How to prepare the SCOTT to use Oracle Text:

    SQL>
    SQL> SHOW USER
    USER is "SYS"
    SQL>
    SQL> GRANT ctxapp TO scott;
    
    Grant succeeded.
    
    SQL> GRANT EXECUTE ON CTXSYS.CTX_CLS TO scott;
    
    Grant succeeded.
    
    SQL> GRANT EXECUTE ON CTXSYS.CTX_DDL TO scott;
    GRANT EXECUTE ON CTXSYS.CTX_DOC TO scott;
    GRANT EXECUTE ON CTXSYS.CTX_OUTPUT TO scott;
    GRANT EXECUTE ON CTXSYS.CTX_QUERY TO scott;
    GRANT EXECUTE ON CTXSYS.CTX_REPORT TO scott;
    GRANT EXECUTE ON CTXSYS.CTX_THES TO scott;
    GRANT EXECUTE ON CTXSYS.CTX_ULEXER TO scott;
    Grant succeeded.
    
    SQL>
    Grant succeeded.
    
    SQL>
    Grant succeeded.
    
    SQL>
    Grant succeeded.
    
    SQL>
    Grant succeeded.
    
    SQL>
    Grant succeeded.
    

    Now the test itself:

    SQL> SHOW user
    USER is "SCOTT"
    SQL> --My database version.
    SQL> SELECT * FROm v$version;
    
    BANNER
    --------------------------------------------------------------------------------
    Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
    PL/SQL Release 11.2.0.1.0 - Production
    CORE    11.2.0.1.0      Production
    TNS for Linux: Version 11.2.0.1.0 - Production
    NLSRTL Version 11.2.0.1.0 - Production
    
    SQL> SELECT * FROM location_source;
    
          CODE DESCRIPTION
    ---------- ----------------------------------------------------------------------------------------------------
               check in london
               flight Paris 9.30
               baggage allowance 20kg Hong kong
               check out 6.30
               new york 23rd Jul
               flight jy688 sydney
    
    6 rows selected.
    
    SQL> SELECT * FROM location_lookup;
    
          CODE LOCATION_L
    ---------- ----------
             1 London
             2 London
             3 Paris
             4 Hong Kong
             5 Paris
             6 New York
    
    6 rows selected.
    
    SQL> CREATE INDEX location_source_idx ON location_source(description) INDEXTYPE IS CTXSYS.CONTEXT;
    
    Index created.
    
    SQL>  EXEC DBMS_STATS.GATHER_TABLE_STATS(USER, 'LOCATION_SOURCE', cascade=>TRUE);
    
    PL/SQL procedure successfully completed.
    
    SQL> ed
    Wrote file afiedt.buf
    
      1  SELECT ls.code,
      2    ls.description,
      3    MIN(ll.code) new_code,
      4    ll.location_lookup
      5  FROM location_source ls
      6  LEFT OUTER JOIN location_lookup ll
      7  ON contains(ls.description,ll.location_lookup)>0
      8  GROUP BY ls.code,
      9    ls.description,
     10*   ll.location_lookup
    SQL> /
    
          CODE DESCRIPTION                                                                                            NEW_CODE LOCATION_L
    ---------- ---------------------------------------------------------------------------------------------------- ---------- ----------
               check in london                                                                                               1 London
               baggage allowance 20kg Hong kong                                                                              4 Hong Kong
               check out 6.30
               new york 23rd Jul                                                                                             6 New York
               flight Paris 9.30                                                                                             3 Paris
               flight jy688 sydney
    
    6 rows selected.
    

Maybe you are looking for

  • Once a day linking Bing itself forces on FireFox. He interrupts the connection.

    Once a day linking Bing itself forces on FireFox. He interrupts the connection. This is the link that is displayed: go.microsoft.com/fwlink/?LinkID=219472 & clcid = 0x409 I get this message: the connection was reset The connection to the server was r

  • HP Envy5530 series - HP64C25A: HP scanning and Capture does not work

    Recently my HP Scan application capture & has stopped working. So far the application worked perfectly. I tend to use it rarely, so the first cause can occur some time in the past weeks. The printer is connected to my laptop via a wifi connection & i

  • Stop the attachments for printing go to note pad.

    I have the Printer A940 connected to an old computer that my computer illiterate husband uses for games and internet.  My problem is I'll send an email from my computer operating system windows 7 to XP OS from windows of my husband and I want to prin

  • Administrator denies access to do anything on my laptop

    I received this error message indicating a not enough space on recovery (D). As administrator, I can't access anything on my laptop. Don't know what caused it. Any command to system admin I get an error stating that I don't have the privileges. I can

  • New U2412M with lines green and other defects

    I just bought a U2412M for use as a secondary monitor, but when in use, there is a certain green lines dotted on the screen flicker. I also noticed persistent horizontal white lines in the areas of gray. I guess it's a driver issue, but I have since