Sign Up

Sign Up to our social questions and Answers to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In


Have an account? Sign In Now

Sign In

Login to our social questions & Answers to ask questions, answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Sorry, you do not have permission to add post.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Oraask Logo Oraask Logo
Sign InSign Up

Oraask

  • Write
    • Add A New Post
    • Ask A Question

Oraask Navigation

Search
Ask A Question

Mobile menu

Close
  • Categories
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Dev Tools
    • Online Compiler
    • Base64 Converter
  • Wiki
    • SQL Tutorials
    • Java Tutorials
    • Python Tutorials
    • JavaScript Tutorials
Home/ Questions/Q 3784
Next
Answered

Oraask Latest Questions

Question
ayaali
  • 0
  • 0
ayaaliExplorer
Asked: June 14, 20162016-06-14T23:55:15+03:00 2016-06-14T23:55:15+03:00In: PL/SQL

How to read excel file from oracle pl/sql ?

  • 0
  • 0

please i want to read excel (.xlsx) from PLSQL ? is that possible or not ?

excelexcel into oraclehow to read excel file in oracle stored procedurehow to read xlsx file in oracleoraclepl sql read excel filepl/sql
1
  • 1 1 Answer
  • 9k Views
  • 0 Followers
  • 0
Answer
Share
  • Facebook

    Related Questions

    • Export query result to Oracle Server
    • What is the difference between Implicit and Explicit Cursor in Oracle
    • How many triggers can I create on a single table in Oracle Database
    • How many types of collections are there in Oracle
    • Can we extend Varray in Oracle PL/SQL

    1 Answer

    • Voted
    • Oldest
    • Recent
    1. Hassan AbdElrahman
      Best Answer
      Hassan AbdElrahman Master Oracle ACE Pro ♠ | Oracle Senior ERP Technical Consultant
      2016-06-19T09:03:49+03:00Added an answer on June 19, 2016 at 9:03 am

      first thing data must be saved as extension .CSV not .xls
      second we need to create directory and give (EXECUTE, READ, WRITE) privilege to appropriate user which will use this directory later into procedure we will create
      create directory syntax

      CREATE OR REPLACE DIRECTORY 
      TEMP_DIR AS 
      'C:temp';
      GRANT EXECUTE, READ, WRITE ON DIRECTORY TEMP_DIR TO USER WITH GRANT OPTION;

      Note : “C:temp” this statement to create directory on windows server it will be little deference from Linux server.
      third thing you need to create stage table which we will insert data into it by mapping excel column to be the same with columns name :

      CREATE TABLE DOCARCH.TEST
      (
        TYPE_ID       NUMBER
      )

      and now it’s time to read the data inside csv file and inserted to stage table by this procedure

      create or replace procedure imp_proc_test
      is
        file_handle   utl_file.file_type := UTL_FILE.FOPEN('TEMP_DIR','imptestdata.csv','R',5000);
        var1          test.TYPE_ID%type;
        v_string      varchar2 (1000);
      begin
          loop
              begin
              UTL_FILE.get_line(file_handle,v_string);
              var1 := substr(v_string,1,instr(v_string,',',1,1)-1);
              insert into test (TYPE_ID) values (var1);
              exception
                when no_data_found then
                    UTL_FILE.fclose (file_handle);
                    exit;
                 WHEN OTHERS THEN
                   DBMS_OUTPUT.PUT_LINE(sqlcode||sqlerrm);
              end;
          end loop;
          commit;
      end;

      so now after created this procedure just call it by :

      exec imp_proc_test

      at the final there is too many ways to achieve this requirement but we pick easiest one for you so please if you have any addition just share with others here.

        • 0
      • Reply
      • Share
        Share
        • Share on Facebook
        • Share on Twitter
        • Share on LinkedIn
        • Share on WhatsApp

    Leave an answer
    Cancel reply

    You must login to add an answer.

    Forgot Password?

    Need An Account, Sign Up Here

    Sidebar

    Adv 250x250

    Explore

    • Categories
    • Questions
      • New Questions
      • Trending Questions
      • Must read Questions
      • Hot Questions
    • Dev Tools
      • Online Compiler
      • Base64 Converter
    • Wiki
      • SQL Tutorials
      • Java Tutorials
      • Python Tutorials
      • JavaScript Tutorials

    Footer

    Oraask

    About

    Oraask is a website for developers and software engineers who want to learn new skills, share their knowledge, and solve their coding problems. Oraask provides free content on various programming languages and topics, such as Oracle, Python, Java, etc. Oraask also allows users to ask questions and get answers from other members of the community.

    About Us

    • About Us
    • Contact Us

    Legal Stuff

    • Privacy Policy
    • Terms & Conditions

    Follow

    Oraask is licensed under CC BY-NC-SA 4.0Oraask CopyrightOraask CopyrightOraask CopyrightOraask Copyright

    © 2019 Oraask. All Rights Reserved
    With Love by Oraask.

    Insert/edit link

    Enter the destination URL

    Or link to existing content

      No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.