How to make a procedure from a select statement please.....

Dear All,
i am new to oracle db, but i do have nice knowledge on sql in sql server, could you please help me.,,,,, in the below issue
i do have below query in oracle db just joining two views,
select docview.firstname as "First Name", docview.lastname as "Last Name", docview.mrn as "MRN", docview.physician as "Physician", docview.surgicalcong "Surgical Consent Missing", docview.admissionnotemissing "Admin Assessment Missing",
(case (docview.doctype) when 135 then 'Doctor Chart Checklist' else 'DS Chart Checklist' end) as doctypename,
docview.hpmissing "History & Physical Missing", docview.nursingassessment "Nursing Admission/Assessment", docview.anesthesiologymissing "Anesthe Consultation Missing", docview.medicalevalmissing "Medical Evaluation Missing", docview.Doctorlabresultmissing "Doctor Lab Results Missing", docview.outsidelabresultmissing "Outside Lab Results Missing", docview.chestxraymissing "Chest X-Ray Missing",
docview.ekgmissing "Ekg Missing", docview.cardioechomissing "Cardio Echo Missing",docview.stresstestmissing "Stress Test Missing", docview.pulmonaryfunctionmissing "Pulmonary Function Missing"
from DoctorMainView docview inner join DoctoSurgicalView surgicalView on docview.accountid= surgicalView.accountid and docview.mrn= surgicalView.mrn and docview.physician = surgicalView.physician
and docview.lastname=surgicalView.lastname
where docview.doctype in (23,61)
Order by docview.firstname
how can i make a procedure with below two steps,
1) load the result of above query to some temp table / or even a fixed table (which ever easier)
2) list all data from the temp table / fixed table created in first step
so in the final expecting result is
execute myprocnamehere -- will result same as running above query
please help me
thanks a ton in advance
i greatful to you all
Best Regards
Buzzi

Why would you want to extract all of the results from the database and write them to a table just so you could read them back out again? Wouldn't it be simpler just to return the results in one shot?
In general the procedure and call would look something like this:
SQL> create or replace procedure myprocnamehere
  2     ( p_results out sys_refcursor )
  3  as
  4  begin
  5     open p_results for
  6        select 'Results here' as results from dual;
  7  end;
  8  /
Procedure created.
SQL> var myresultset refcursor
SQL>
SQL> call myprocnamehere(:myresultset);
Call completed.
SQL> print :myresultset
RESULTS
Results here
1 row selected.Edited by: William Robertson on Feb 8, 2011 7:13 PM

Similar Messages

  • How to make a slice from a selection?

    Hi everyone,
    So many times I had a square selection and wanted to make a slice from it. Is it possible?

    Use Rectangle or Ellipse Marquee Tools, or Lasso Tools then hold down Alt or Option key and drag on the selection.

  • How to processing the results from the select statement in SQL query?

    Hi
    This might be too simple, but my knowledge of the SQL is very limited...
    I have table where I do have details from calls (Lync QoE).
    I can take all calls from the table, but I would like to count the concurrent calls on the table. This is how I got it work on the Excel to work (but I would like to do that on the SQL statement to get it more dynamic use):
    Table have these line and this is what I get out from the Select):
    [callid],[start],[end]
    1ABC,1.1.2014 01:00:15, 1.1.2014 01:01:00
    5DEF,1.1.2014 01:00:45, 1.1.2014 01:05:00
    FDE2,1.1.2014 01:03:15, 1.1.2014 01:04:00
    KDJ8,1.1.2014 01:04:15, 1.1.2014 01:06:00
    FDJ8,2.1.2014 01:04:15, 2.1.2014 01:06:00
    KDSE,3.1.2014 01:04:15, 3.1.2014 01:06:00
    The information I would like to get, is what is the maximum amount of the concurrent calls per day.
    On the excel I basically count line by line how many concurrent calls each line have had, and then pickup the highest one. On above example the calls 5DEF, FDE2 and FDE2 have been active at the same time which gives 3 for the first day.
    The table is ordered by the start. So let say the code is on the third line (FDE2). I need to count calls from before which end time is after the start time (of FDE2), but also I need to count calls after (FDE2) which are started before the current
    call has ended.
    Petri

    Unfortunately your post is off topic as it's not specific to SQL Server Samples and Community Projects.  
    This is a standard response I’ve written in advance to help the many people who post their question in this forum in error, but please don’t ignore it.  The links I provide below will help you determine the right forum to ask your question in.
    For technical issues with Microsoft products that you would run into as an end user, please visit the Microsoft Answers forum ( http://answers.microsoft.com ) which has sections for Windows, Hotmail,
    Office, IE, and other products.
    For Technical issues with Microsoft products that you might have as an IT professional (like technical installation issues, or other IT issues), please head to the TechNet Discussion forums at http://social.technet.microsoft.com/forums/en-us, and
    search for your product name.
    For issues with products you might have as a Developer (like how to talk to APIs, what version of software do what, or other developer issues), please head to the MSDN discussion forums at http://social.msdn.microsoft.com/forums/en-us, and
    search for your product or issue.
    If you’re asking a question particularly about one of the Microsoft Dynamics products, a great place to start is here: http://community.dynamics.com/
    If you think your issue is related to SQL Server Samples and Community Projects and I've flagged it as Off-topic, I apologise.  Please repost your question and include as much detail as possible about your problem so that someone can assist you further. 
    If you really have no idea where to post your question please visit the Where is the forum for…? forum http://social.msdn.microsoft.com/forums/en-us/whatforum/
    When you see answers and helpful posts, please click Vote As Helpful,
    Propose As Answer, and/or Mark As Answer
    Jeff Wharton
    MSysDev (C.Sturt), MDbDsgnMgt (C.Sturt), MCT, MCPD, MCSD, MCSA, MCITP, MCDBA
    Blog: Mr. Wharty's Ramblings
    Twitter: @Mr_Wharty
    MC ID:
    Microsoft Transcript

  • How to edit stored procedure from sqlplus ?

    Hi,
    Can anyone advise how to edit stored procedure from sqlplus ?
    Many thanks.

    You can get the source for an object from SQL*Plus by querying the user_source table, i.e.
    SQL> create procedure foo
      2  as
      3  begin
      4    dbms_output.put_line( 'foo' );
      5  end;
      6  /
    Procedure created.
    SQL> select text
      2    from user_source
      3   where name = 'FOO'
      4   order by line;
    TEXT
    procedure foo
    as
    begin
      dbms_output.put_line( 'foo' );
    end;Most commonly, though, if you are using SQL*Plus and a text editor to develop stored procedures, you will have all your stored procedures in .sql files that you edit and just use SQL*Plus to create (or recreate) the stored procedures.
    Justin
    Distributed Database Consulting, Inc.
    http://www.ddbcinc.com/askDDBC

  • How to make bootable iso from download

    how to make bootable iso from download

    This one - https://www.microsoft.com/en-us/download/details.aspx?id=5587
    1st:  This is NOT a .ISO file!!
    2nd.  It is a .MSI file which is a Microsoft Installer file.
    3rd:  Read the instructions:
    Install Instructions:
    Click the Download button to start the download.
    Do one of the following:
    To start the installation immediately, click Run.
    To save the download to your computer for installation at a later time, click
    Save.
    To cancel the installation, click Cancel.
    When installation completes a file called readme.txt will open to provide instructions for burning a home computer restore CD. The file is also located
    next to the ISO image file for later reference.
    4th: If you are unable to read and follow instructions, there is nothing anyone in these forums can do to assist you.  You must be capable of reading and following instructions! 
    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread. ”
    OK, well sorry to disagree with you but:-
    1. Using windows 7, the download does not provide a save but only a run option.
    2. In the MS predownload instructions you copied it refers to the readme text next to "the ISO image"
    3. This is a copy of the read me file attached:-
    "This ReadMe document is one of the Windows Home Server Home Computer Restore CD files. Unless you changed the installation location during setup, the Home Computer Restore CD files and license terms are located in one of the following folders:
    * On Windows Vista: %HOMEPATH%\Documents\Windows Home Server Home Computer Restore CD (Dual Boot)
    * On Windows XP: %HOMEPATH%\My Documents\Windows Home Server Home Computer Restore CD (Dual Boot)
    To use the Home Computer Restore CD software, you must write the ISO image file (restorecd_dual.iso) to a blank CD. A CD/DVD burner is required to write
    the ISO image file to the CD. Usually a CD/DVD burner includes the software that you need to write ISO image files. Follow the instructions with your burner software, and then select the option to write an ISO image, not the option to write
    individual files. Note that you cannot write the ISO image by using Windows Explorer to copy the file to the CD-ROM drive.
    Burning the ISO image creates a bootable CD. To restore your home computer, boot the computer from the CD and follow the instructions.
    Microsoft may update the Windows Home Server Home Computer Restore CD software. You can download the latest version from the Microsoft Web site at http://go.microsoft.com/fwlink/?LinkID=109282.
    If you want to review the license terms for the Windows Home Server Home Computer Restore CD, the file EULA_DUAL.TXT can be found in the same folder"
    As you will see it refers to the downloaded .iso file. Nowhere is there a reference to a msi.  As there was only a run function on the downloaded file, it could not be saved. How is an ordinary Windows user meant to interpret the instructs
    if the download function does not work? What you do is try and follow the instructions and produce a load of frigging coffee mats, as it seems did many of the posters on this thread. Are we all illiterate?
    If Microsoft could think in the way of a user it would help a lot of people.
    So Rick Dee, please inform me how I misread the instructions?

  • My message always comes from my iCloud @me handle and not my other IM accounts when I send an IM? How to make it come from my @gmail account?

    My message always comes from my iCloud @me handle and not my other IM accounts when I send an IM? How to make it come from my @gmail account?

    Hi,
    As you have found in the View Menu of iChat is the option to Display the Recipients Bar
    This bar when clicked will display the Screen Names that you know for your Buddy and your own Screen Names.
    The Buddy's names are in the "To:-" section whilst your own are in the "From:-"
    Example pic from my iChat 6
    The Chat window has to Be Open.
    The Buddy's current name becomes a Drop Down that show the To and From names.
    It appears to allow you to Connect Google or Jabber IDs to AIM Buddies but the tick will move to any valid Account if you change either the To choice or the From choice.
    AS you say about the add Buddy drop down that appears - when your Buddy list are displayed as one an extra drop down appears fro you to Select the account/list it is joining as a Buddy
    8:17 PM      Wednesday; January 4, 2012
    Please, if posting Logs, do not post any Log info after the line "Binary Images for iChat"
      iMac 2.5Ghz 5i 2011 (Lion 10.7.2)
     G4/1GhzDual MDD (Leopard 10.5.8)
     MacBookPro 2Gb (Snow Leopard 10.6.8)
     Mac OS X (10.6.8),
    "Limit the Logs to the Bits above Binary Images."  No, Seriously

  • How to get the values from html:select? tag..?

    i tried with this, but its not working...
    <html:select styleClass="text" name="querydefs" property="shortcut"
                 onchange="retrieveOptions()" styleId="firstBox" indexed="true">
    <html:options collection="advanced.choices" property="shortcut" labelProperty="label" />
    </html:select>
                        <td align="left" class="rowcolor1">
                        <script language="javascript" type="text/javascript">
                              function retrieveOptions(){
                             var sel = document.querydefs.options;
                             var selectedOption = sel[sel.selectedIndex].value;
                             document.write(selectedOption);
                           </script>

    <td align="left" class="rowcolor1">
                        <script language="javascript" type="text/javascript">
                              function retrieveOptions(){
                             var sel = document.querydefs.options;
                             var selectedOption = sel[sel.selectedIndex].value;
                             document.write(selectedOption);
                           </script>This java script is not working at all..its not printing anything in document.write();
    This is code..
    <td class="rowcolor1" width="20%">
    <html:select styleClass="text" name="querydefs" property="shortcut"
                             onchange="retrieveSecondOptions()" styleId="firstBox"
                             indexed="true">
                             <html:options collection="advanced.choices" property="shortcut"
                                  labelProperty="label"  />
                        </html:select>i tried with this also. but no use..i'm not the getting the seleced option...
    function retrieveOptions(){
    firstBox = document.getElementById('firstBox');
                             if(firstBox.selectedIndex==0){
          return;
        selectedOption = firstBox.options[firstBox.selectedIndex].value;
    }actually , how to get the values from <html:select> ...?
    my idea is to know which value is selected from the combo box(<html:select> ) if that value is equal some string i have enable a hyperlink to open a popup window

  • How to Remove the underline from the selection screen parameter

    How to remove the underline from a selection screen parameter ?

    >
    Anoop Menon wrote:
    > hi Avinash,
    >
    > I am not able to understand the use of the 'comment line properly.
    >
    > The last part of the statement which says modif id is confusing.
    >
    > Please clarify..... I am unable to activate my code when I put the selection screen commebnt statement.
    Use this and update it to your requierement !
    SELECTION-SCREEN begin of line.
    SELECTION-SCREEN COMMENT 1(30) comm.
    PARAMETERS test(1) type c.
      SELECTION-SCREEN end of line.
    INITIALIZATION.
      comm = 'test'.

  • How to pass an array to a function from a SELECT statement

    Hi all. I have a problem with passing an array to a function directly from a SELECT statement.
    Here is what I want. If I have a function
    function AAA(arrayVar <ArrayType>) return number;
    I want to be able to call this function this way
    select AAA((2,3,4))
    from dual
    or this way
    select AAA((10,12))
    from dual
    In other words I want to be able to pass an arbitrary number of numbers to the function. And I want this to work in a SELECT statement.
    Does anyone have any ideas how to implement this? What <ArrayType> should I use?(I've read about VARRAY, nested tables in the Oracle documentation but as far as I've understood these array types are meant to be used within PL/SQL blocks).
    I found only this http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:208012348074 through Google but it didn't help me.
    Thank you in advance.

    > What <ArrayType> should I use?
    SQL data types - as 3360 showed above. You cannot use PL/SQL structures and user types in the SQL Engine.
    You can however use all SQL structures and types in PL/SQL.
    Arrays in SQL is created as collection type - basic o-o. The collection type (or class) serve as a container for instantiated objects or scalar type.
    This is covered in detail in [url http://download-uk.oracle.com/docs/cd/B19306_01/appdev.102/b14260/toc.htm]
    Oracle® Database Application Developer's Guide - Object-Relational Features

  • How to call stored procedure from Pro*C

    How to call stored procedure from Pro*C ?
    my system spec is SuSE Linux 9.1, gcc version : 3.3.3, oracle : 10g
    my Pro*C code is the following..
    EXEC SQL EXECUTE
    begin
    test_procedure();
    end;
    END-EXEC;
    the test_procedure() has a simple update statement. and it works well in SQL Plus consol. but in Pro*C, there is a precompile error.
    will anybody help me what is the problem ??

    I'm in the process of moving C files (with embedded SQL, .PC files) from Unix to Linux. One program I was trying to compile had this piece of code that called an Oracle function (a standalone), which compiled on Unix, but gives errors on Linux:
    EXEC SQL EXECUTE
    BEGIN
    :r_stat := TESTSPEC.WEATHER_CHECK();
    END;
    END-EXEC;
    A call similar to this is in another .PC file which compiled on Linux with no problem. Here is what the ".lis" file had:
    Pro*C/C++: Release 10.2.0.1.0 - Production on Mon Jun 12 09:26:08 2006
    Copyright (c) 1982, 2005, Oracle. All rights reserved.
    Error at line 193, column 5 in file weather_check.pc
    193 BEGIN
    193 ....1
    193 PCC-S-02346, PL/SQL found semantic errors
    Error at line 194, column 8 in file weather_check.pc
    194 :r_stat := TESTSPEC.WEATHER_CHECK();
    194 .......1
    194 PLS-S-00000, Statement ignored
    Error at line 194, column 18 in file weather_check.pc
    194 :r_stat := TESTSPEC.WEATHER_CHECK();
    194 .................1
    194 PLS-S-00201, identifier 'TESTSPEC.WEATHER_CHECK' must be declared
    Pro*C/C++: Release 10.2.0.1.0 - Production on Mon Jun 12 09:26:08 2006
    Copyright (c) 1982, 2005, Oracle. All rights reserved.
    System default option values taken from: /oracle_client/product/v10r2/precomp/ad
    min/pcscfg.cfg
    Error at line 194, column 18 in file weather_check.pc
    :r_stat := TESTSPEC.WEATHER_CHECK();
    .................1
    PLS-S-00201, identifier 'TESTSPEC.WEATHER_CHECK' must be declared
    Error at line 194, column 8 in file weather_check.pc
    :r_stat := TESTSPEC.WEATHER_CHECK();
    .......1
    PLS-S-00000, Statement ignored
    Semantic error at line 193, column 5, file weather_check.pc:
    BEGIN
    ....1
    PCC-S-02346, PL/SQL found semantic errors

  • How to make a silhouette from a portrait (photo) and-

    How do I make a silhouette from a portrait?
    And how do I make the background transparent?

    Do you mean that I send you the portrait?
    Chabæna
    26 apr 2014 kl. 12:31 skrev c.pfaffenbichler <[email protected]>:
    Re: How to make a silhouette from a portrait (photo) and…
    created by c.pfaffenbichler in Photoshop General Discussion - View the full discussion
    How do I make a silhouette from a portrait?
    Ah, but wouldn’t it be ever so much easier to explain if you actually provided (a lores of) the image in question?
    And how do I make the background transparent?
    Preferably with a Layer Mask and then saving in the appropriate file format (psd or png24 for example support transparency).
    Please note that the Adobe Forums do not accept email attachments. If you want to embed a screen image in your message please visit the thread in the forum to embed the image at http://forums.adobe.com/message/6332417#6332417
    Replies to this message go to everyone subscribed to this thread, not directly to the person who posted the message. To post a reply, either reply to this email or visit the message page: http://forums.adobe.com/message/6332417#6332417
    To unsubscribe from this thread, please visit the message page at http://forums.adobe.com/message/6332417#6332417. In the Actions box on the right, click the Stop Email Notifications link.
    Start a new discussion in Photoshop General Discussion at Adobe Community
    For more information about maintaining your forum email notifications please go to http://forums.adobe.com/thread/416458?tstart=0.

  • How to make data flow from one application to other in BPEL.

    Hi All,
    I am designing work-flow of my application through BPEL(JDeveloper), I am making different BPEL projects for different functions, like sales manager got the order from sales person and sales manager either approve it or reject it, if he approve it it goes to Production manager and he ships the goods, now I want to keep sales person, sales manger,production manager in seperate BPEL files and want to get the output of sales person to sales manager and sales manager to production manager please help me in dong this.
    I was trying to make partner link in Sales manager of sales person and getting the input from there. I dont know this is right even or not, if it is right I dont know how to make data flow from one application to other.
    Experience people please guide.
    Sales Person -----> Sales Manager ----> Production Manager
    Thanks
    Yatan

    Yes you can do this.
    If you each integration point to be in different process, you have to create three BPEL process.
    1. Create a Async BPEL process 'A' which will be initiated when sales person creates the order.
    2. From BPEL process 'A' call a ASync BPEL process 'B' which has the approval flow. Depending on the input from process 'A' the sales manager will review the order in workflow and approve or reject and send the result back to process 'A'.
    3. Based on the result from workflow, invoke the Sync BPEL process 'C', where you can implement the shipping logic.
    -Ramana.

  • How to execute a procedure from BODI?

    Hi Pals ,
    I have procedure in my database say EMP_PROC. I want to execute this procedure from the BODI environment.Please do let me know.
    Thanks in advance.
    Regards,
    Diras

    you have to import the stored procedure in the datastore
    and after importing you can call the stored procedure in the mapping
    use import by name option in datastore, and select function in type and enter the name of stored proc that you want to use in DI
    check technical manual for more details on importing functions and stored procedure

  • How to make one dvd from several camcoder dvd's

    How to make one dvd from several camcoder dvd's. I got a dvd camcoder, to be able to play them into DVD player I had to finalize  my disks. Now I got several DVD's whith short files and terrible custom camera menu. I'd like to make it more presentable.
    The main problem is I dont want to recode my vob files. So Final Cut and other editing soft is bad idea.
    Is there any soft on mac I could reauthor my DVD's?

    How to make one dvd from several camcoder dvd's. I got a dvd camcoder, to be able to play them into DVD player I had to finalize  my disks. Now I got several DVD's whith short files and terrible custom camera menu. I'd like to make it more presentable.
    The main problem is I dont want to recode my vob files. So Final Cut and other editing soft is bad idea.
    Is there any soft on mac I could reauthor my DVD's?

  • HT1338 how can make a room from my start up disk in in mac pro

    how can make a room from my start up disk in in mac pro

    Only you can decide what you want to delete to free up space on your PB, Personally I think you'll find 17 GB won't go very far when you start to add video.
    Consider an external drive. Don't forget if you let your free space fall below 10% of the total size of the drive you will risk corrupting your directory structure or causing other damage which may result in a loss of data.

Maybe you are looking for

  • Yoga 2 Pro WONT TURN ON (backlight flickers)

    First time poster here, I recently purchased a yoga 2 pro approximately one week ago in Hong Kong from a technology reseller (Fortress). Was super excited, majority of reviews were glowing etc. However, after taking home and using it for less than an

  • DV9428NR hard drive upgrade woes

    Why is it impossible to successfully and functionally change and upgrade the secondary HDD on the DV9428NR?  I tried for two days, Geek Squad tried for two days and a local computer repair shop tried for two days to do a simple HDD upgrade on this pa

  • Using an Ipod as a picture bank?

    Is there any way of connecting a compact flash reader to an ipod, so you can use it as a picture back to store digital images in the field?

  • Error in Order flow between COM to SOM

    Hi, We are facing some issues in order flow after submitting the order from CRM to OSM COM. What we observed that order gets created in COM, but not being created in SOM. In the logs, it is giving some resource xquery not found exception. We are usin

  • [solved] Fluxbox gets "messy" after upgrade

    Today I updated Xorg (pacman -Syu), and for some reason it, sort of, breaks Fluxbox. I say sort of, because it does not break it completely. Immediately after the update, the left and right mousebutton stopped working; however the middle mouse button