Procedure to display the view number and execution time


Hi all

I'm creating a procedure to display the name of the view and its County and runtime to get this number if we adopt the view name in the procedure. so far, I have created the script below but it does not give any number. Please suggest me an idea to achieve this. I use Oracle Database 11 g Enterprise Edition Release 11.2.0.3.0 - 64 bit Production.

CREATE OR REPLACE PROCEDURE VIEW_TIME_SP ( P_VIEW_NAME IN VARCHAR2 )
IS
  V_START_DATE TIMESTAMP;
  V_END_DATE  TIMESTAMP;
  V_ROW_COUNT NUMBER;
  V_SQL       VARCHAR2(1000);
  V_LOG       VARCHAR2(1000);
  V_EXECUTION_TIME INTERVAL DAY TO SECOND;
  V_VIEW_NAME  VARCHAR2(40);

BEGIN
V_VIEW_NAME := P_VIEW_NAME;
EXECUTE IMMEDIATE 'ALTER SESSION SET NLS_DATE_FORMAT = ''dd-Mon-yyyy hh24:mi:ss''';
     
V_START_DATE := CURRENT_TIMESTAMP;
V_ROW_COUNT := 0;
V_SQL := 'SELECT COUNT(*) INTO' || V_ROW_COUNT || ' FROM '  || V_VIEW_NAME;
EXECUTE IMMEDIATE V_SQL;
V_END_DATE := CURRENT_TIMESTAMP;
V_EXECUTION_TIME := V_END_DATE - V_START_DATE;
V_LOG := V_VIEW_NAME || ' returns ' || V_ROW_COUNT || ' and completed in ' || V_EXECUTION_TIME;
DBMS_OUTPUT.PUT_LINE (V_LOG);
EXCEPTION
  WHEN OTHERS THEN
   DBMS_OUTPUT.PUT_LINE ('process failed:' || SQLCODE || ': ' || SQLERRM);
END VIEW_TIME_SP;

Appreciate your help.

Thank you

Hello

MSB says:

Hi all

I'm creating a procedure to display the name of the view and its County and runtime to get this number if we adopt the view name in the procedure. so far, I have created the script below but it does not give any number. Please suggest me an idea to achieve this. I use Oracle Database 11 g Enterprise Edition Release 11.2.0.3.0 - 64 bit Production.

  1. CREATE OR REPLACE PROCEDURE VIEW_TIME_SP (P_VIEW_NAME IN VARCHAR2)
  2. IS
  3. V_START_DATE TIMESTAMP;
  4. V_END_DATE TIMESTAMP;
  5. NUMBER OF V_ROW_COUNT;
  6. V_SQL VARCHAR2 (1000);
  7. V_LOG VARCHAR2 (1000);
  8. V_EXECUTION_TIME INTERVAL DAY TO SECOND.
  9. V_VIEW_NAME VARCHAR2 (40);
  10. BEGIN
  11. V_VIEW_NAME: = P_VIEW_NAME;
  12. EXECUTE IMMEDIATE 'ALTER SESSION SET NLS_DATE_FORMAT = "dd-Mon-yyyy hh24:mi:ss" ';
  13. V_START_DATE: = CURRENT_TIMESTAMP;
  14. V_ROW_COUNT: = 0;
  15. V_SQL: = ' SELECT COUNT (*) IN "| V_ROW_COUNT | 'FROM ' | V_VIEW_NAME;
  16. IMMEDIATELY RUN V_SQL;
  17. V_END_DATE: = CURRENT_TIMESTAMP;
  18. V_EXECUTION_TIME: = V_END_DATE - V_START_DATE;
  19. V_LOG: = V_VIEW_NAME | 'returns "| V_ROW_COUNT | "and completed in | V_EXECUTION_TIME;
  20. DBMS_OUTPUT. PUT_LINE (V_LOG);
  21. EXCEPTION
  22. WHILE OTHERS THEN
  23. DBMS_OUTPUT. Put_line (' process failed:' |) SQLCODE. ': ' || SQLERRM);
  24. END VIEW_TIME_SP;

Appreciate your help.

Thank you

Whenever you write dynamic SQL code, during the debugging phase, display the dynamic string before running it.  For example

V_SQL: = ' SELECT COUNT (*) IN "| V_ROW_COUNT | 'FROM ' | V_VIEW_NAME;
dbms_output.put_line (v_sql |) '= v_sql in view_time_sp");
IMMEDIATELY RUN V_SQL;

You will see that v_sql is something like:

SELECT COUNT (*) VIEW_X INTO0'

You do not want the value of v_row_count; you want the name v_row_count, and he didn't need to be part of the dynamic statement.  Try this:

V_SQL: = ' SELECT COUNT (*) FROM "| V_VIEW_NAME;
dbms_output.put_line (v_sql |) '= v_sql in view_time_sp");
EXECUTE IMMEDIATE V_SQL IN v_row_count;

Tags: Database

Similar Questions

  • Display the page number and the total number of pages in a single domain. Is this possible?

    I would like to than my report to view the number of page in the format "< page number > of < total page >", as "2 of the 6". Rather than create 2 fields to display the page number and the total number of pages and 1 label to display the word 'from' in the Middle, can I combine all of this into one? If so, how?

    Note: I woud wants to use "physical page number" as "total physical pages" and page number as the total number of pages.

    Published by: 1008305 on June 6, 2013 19:31

    Hello

    It is not possible to write in a.

    Even I try for the same, but didn't find any solution.

    We ave only two options to display the page number;

    1.) reports under construction Page number option: string will be: page & to &

    2.), we can take 2 text field that displays the page number and the total number of pages with 'from' lable inside the two text fields.

    IF any new you will come to know then.

    Thank you

    SHAH HARD

  • How to make a table of contents to display the chapter number and chapter text together

    I'm working on 11 of FrameMaker. How can I get my Table of contents (TOC) to display the chapter number and chapter title on one line. My chapter titles have the chapter number and chapter title on two lines, two centered at the top of a new page. I wish that my OCD to pick the chapter number and chapter name on one line not two. Thank you.

    If you'v created the table of contents with activation of hyperlinks (default) setting, and then simply hold the CTRL + alt keys and click on empty entries in your TOC file. FM will open the file containing the entrry and jump to the correct section.

  • AudioPlayer does not display the horizontal color and elapsed time of the mpe3file (only total time)

    In AudioPlayer widgets das invaluable problem 3: der outwardarrondie nicht den Verlauf one shows Balk, auch nicht die vergangene Abspielzeit of mp3 files.

    Nur die total of mp3 files. In musegrid, musegain und freiem audioplayer.

    Time played, time remaining, etc. should be included in itself the video widget embedded code. I suggest you to contact the original publisher of the widget.

    Thank you

    Sanjit

  • My iPhone jpeg images do not display the view I want. PC displays the generic icon and not the photo itself.

    The only way to see the images 'discovered' or 'open' individual icon.

    Miniatures,

    Open your my pictures location, click organize in the upper left corner, click folder and search options, click the View tab and uncheck the top option, always display icons and never thumbnails, select apply to records on the top and apply and OK on the bottom.

    If the photo thumbnails appear now but look washed on a right click and select Properties, on the section of the general tab, uncheck the box for the hidden attribute and save it.

    Return to your location of my pictures, change the display of the page on the top of the right side next to the question mark symbol, there is another symbol with a drop-down arrow, click it and select the medium or large icons options specified.

    Rotate pictures of iphone 4s,

    Right-click and point to open with and click on the paint,

    Rotation, click on save.

    Turn videos,

    Click right and Point t open with and click on Windows live movie maker.

    Rotate and Save is in the upper right.

  • I tried EvevryThing! The "CREATED WITH ADOBE ELEMENTS 9 TRAIL VERSION FIRST" will not stop Displaying, even after I put in the serial number and Regerstered. Also the product does not show under my profile?

    I tried EvevryThing! The "CREATED WITH ADOBE ELEMENTS 9 TRAIL VERSION FIRST" will not stop Displaying, even after I put in the serial number and Regerstered. Also the product does not show under my profile?

    How can I fix it? Nothing in help or on the Site.

    Once you have registered the product, you should not see the banner of 'Trial' on NEW projects. This isn't the case, right? You only see on the project that you created before you register the product, right?

    That said, to remove the banner, go to the folder of directory on your hard drive where your project PREL files are stored and delete the folder called Adobe Premiere elements preview files.

  • Force display the top menu and the scrubber in Adobe Content Viewer?

    Hello

    I have problems to display the top menu and scrubbing machines (see below), regardless of where I tap on the screen, it does not appear. I think it has something to do with most of my pages by having a web site with overlay. How can I fix it? Or y at - there a way to force this top menu/scrubber? A button for < a navto://topmenu > would be great

    menu.png

    You must provide space on the page somewhere that the reader can draw to bring it. If your HTML content supports the entire screen and uses gestures then the drive will not be able to raise the bar. It is, unfortunately, no way to set it explicitly html off.

    Note that we have addressed this in the next generation of Digital Publishing Solution (aka DPS 2015). Depending on your project, you might want to try the beta and the new APIs, we have for authors of HTML content that give you control over gestures and when our chrome shows full.

    Neil

  • Using the procedure to display the table of multiple data

    Hi, I need help for the procedure in oracle

    I want to create the procedure to display the table of multiples with sample plan

    with a parameter imployee_id to display an employee_id, name, function, start_date, end_date

    IAM using this query to select more than one table

    SELECT e.employee_id, e.first_name, j.job_title, h.start_date, h.end_date

    E EMPLOYEES

    JOIN j jobs

    ON j.job_id = e.job_id

    JOIN the job_history:

    ON h.employee_id = e.employee_id

    WHERE e.employee_id = 200;

    Thanks for the help

    Blu and Billy showed you the 'real' solution. You can display the data returned by a cursor ref in SQL Developer, too:

    http://www.thatjeffsmith.com/archive/2011/12/SQL-Developer-tip-viewing-refcursor-output/

    Yet as a duty for a beginner is generally do not have the expected solution. Usually, teachers want to see you using a LOOP and dbms_output. something like

    DECLARE

    Xy CURSOR IS

    SELECT whatever

    As much as;

    BEGIN

    FOR r IN xy LOOP

    dbms_output.put_line (r.col1 |' # ' | r.col2);

    END LOOP;

    END;

    Of course this suggestion will inaugurate a discussion abusing DBMS output but I keep my position that it is authorized to use it for learning the basics.

  • How to display the total number of rows in the dashboard

    Hello

    I have a dashboard report for retrieving the list of projects and details, it grows on a daily basis, instead of users downloading the report and find out the total number of projects, I want to display 'the total number of projects' alone in the dashboard. How can I do?

    Also is it possible to do like a pop up or something a little flash news - not necessary, but will be very good if I can do it.

    Thanks for your time and your help.

    create a report and a column to write a column invert the function max (rcount (1)). Call this column depending on the position of the column (as @1) in narrative mode.
    You can view only the narrative in the dashboard.

    for flash type of report, you can use the ticker view and call the same column in the view.

    refer to this link to view the total number of records
    http://Siebel.ITtoolbox.com/groups/technical-functional/Siebel-Analytics-l/display-row-count-in-top-of-the-table-view-3704999

    assign points if found useful.

  • display the Total number of lines in the first page of the report

    Hi, in obiee, paging will be 1-25. Is there any possibility in obiee to display the total number of lines next to paging. Ex: If the result contains the 120 lines. It should show after paging

    Documents 1-25. Total records: 120

    User,

    If this is the very simple case go in narrative display

    In the Narrative section give

    No.Of.Records: @4

    in my case is 4th column: No.Of.Records where fx = max (rcount (1))

    GoTo Compound display click the button Add and align narrative view down to see table

    Thank you
    Saichand.v

  • I change the settings of firefox and accidentally closed on the display tab, which displays the files, settings, and tools. I can't see how to reset it back to default where I can see those?

    I change the settings of firefox and accidentally closed on the display tab, which displays the files, settings, and tools. I can't see how to reset it back to default where I can see those?

    You can hide the menu bar in Firefox 3.6 on Windows, on "view > toolbars" or via the contextual right click menu on a toolbar.
    Press in and hold the Alt key to display the menu bar.
    Go to "view > toolbars", right click on the menu bar, or press Alt + V T to select the toolbars to show or hide.

    See also what happened to the file, edit and view menus?

  • Display the line number in TextEdit

    I'm trying to twist around the preferences and browsing the web, if there is a way to display the line numbers in the TextEdit application. I could not find, how is it possible to display the line number?

    OS: Mac OS X El Capitan

    No, but the free TextWrangler has add/remove line numbers in the text menu, you could copy of TE & paste in TW.

  • How to display the line number in the form?

    Hi guys,.
    First I fll you in the story so far...

    I have a block of data in database named: V_PAYUPLOADHEADER_HP, in the property palette I put in order by facility and warehouse.

    I want to display the line number for each record of recoveries, so I do: V_PAYUPLOADHEADER_HP. NUMB, which will contain the line number.


    Here are some methods I've already tried:
    -First I tried to make a database of field element = O, column name = ROWNUM.
    The result is the jump of integer (1, 2, 5, 3, 4 etc. instead of 1, 2, 3, 4, 5) I think it is because of the agenda that I set.
    I have to keep this order by setting, so I look for another way to display the rownum.

    -Then I tried to set the data item = N, column name = null, mode of calculation = formula, formula =: system.trigger_record.
    When I run the value of: V_PAYUPLOADHEADER_HP. NUMB is 1. For all recovered records is 1, 1, 1, 1 instead of 1, 2, 3, 4.

    -J' also tried to use the trigger after QUERY attached to the block.
    In relaxation, I have this code:
    : V_PAYUPLOADHEADER_HP. NUMB: =: system.cursor_record;
    When I run the value of: V_PAYUPLOADHEADER_HP. NUMB is 1. For all recovered records is 1, 1, 1, 1 instead of 1, 2, 3, 4...



    Is there something I missed?
    What can I do to display the rownum?

    Hello
    Maintain this point NON-base of DATA and create a trigger on the block called after REQUEST level and use the code below...

    :FIELD_NAME:=:SYSTEM.TRIGGER_RECORD;
    

    -Clément

  • How to display the phone number with code in the text element

    Hello friends,

    I have table "customer_management. In this table, I have a phone number of field in the varchar2 data type.
    the storage format of the telephone number is: (code-phone number) for example 0902334-324345
    Ok. I created a form of this table in the data block. This form I want to view the phone number and code in two text elements... So, should I create a query to do this... Pls help me with a query... What trigger is suitable for it?
    Please give me example query...

    Thank you

    Hello
    If you are using

    :TAA_CUSTOMER_MANAGEMENT.CONTACT_PHONE_NO
    :TAA_CUSTOMER_MANAGEMENT.NUMBERS
    

    are these above said are elements not db?
    If yes then its get accessor for fill in post-interrogez trigger.
    Just check substring and instring functions that return the value.

    Published by: user13329002 on March 3, 2011 01:47

  • HP laptop: enter the model number and get a "game too many results.

    My HP laptop dies after 6 weeks. When I contact support, he asks the model number. I enter: say "15-ay041wm" is what the box and laptop. I get a reply that says.

    "Sorry, too many results match your search for 15-1y041wm.

    "So I try HP Notebook, I get the same mesaage above, except with the HP laptop ' instead of '15-ay041wm.

    Because no matter where I'm going, he wants the model number and I give, I can't help. No cat, no nothing.

    So someone can tell me how to get support?

    If HP is unable to handle the number of model of it's own computers, so I'm not very confident.

    Here are the free support number to call in the USA/Canada... 1 800-474-6836.

    Now here's another question, you can report to HP on if you want...

    You must stay online and listen to the automated assistant trying to talk to you to talk to a representative... visit the HP website... go to this support forum (which has no official presence in HP), etc.

    After a minute or two, the Assistant to say, if you can't get online, will stay on the line to speak to a customer services representative.

    This is when you will have the opportunity to speak with a support person and report the problem to open a pension case.

Maybe you are looking for

  • several alerts to an event in iCal

    Is it possible to apply several alerts to an event in the calendar. I often have an event and I want to be alerted to tell about the week before and then 1 day before

  • After the transition from XP to Windows 7, I lost my ability to scan and fax.

    When I go to the interface of the software (on my desktop), instead of being able to set up a scan and save it to a document, I now get a message that my installation of the software is incomplete.  He tells me that I have to connect via USB to compl

  • error on vista with warcraft 3

    whenever I try to run warcraft 3, I get a footstool to im C:\windows\system32\gameux.dll error under service pack 2 and as an administrator. What is my problem

  • Pavilion: Help please

    I downloaded a soft music that says Norton were safe, but the minute I opened it, my computer froze. So I restarted and it will allow me to connect but then just goes to a black screen with the mouse. What should I do?

  • Backup and restore cfg question

    I'm afraid that my Linksys E2000 crumbles and may need to be replaced.  I have a number of assigned IP addresses and want to keep, as well as my original network ID and password if I need to replace.   I did a backup of the Admin cfg file > section f