I am trying to create a function that would be on the table type returns.

Gurus,

I am trying to create a function that returns a table nested with 3
columns in a table as a guy.

my query is like

Select col1, col2, col3 from table_1;

I am a bit newbie in Oracle and have never used collections.
Can you please guide?

>
I am a bit newbie in Oracle and have never used collections.
>
Then you should start with the documentation
http://docs.Oracle.com/CD/B28359_01/AppDev.111/b28370/TOC.htm

Chapter 5 is all about collections using PL/SQL and examples
>
I am trying to create a function that returns a table nested with 3
columns in a table as a guy.
>
This isn't enough of a description to know what you're trying to do, or how you plan to use the service. The query you provided is completely irrelevant to the question you are asking.

You ask about functions in pipeline? Here is an example of this

-- type to match emp record
create or replace type emp_scalar_type as object
  (EMPNO NUMBER(4) ,
   ENAME VARCHAR2(10),
   JOB VARCHAR2(9),
   MGR NUMBER(4),
   HIREDATE DATE,
   SAL NUMBER(7, 2),
   COMM NUMBER(7, 2),
   DEPTNO NUMBER(2)
  )
  /

-- table of emp records
create or replace type emp_table_type as table of emp_scalar_type
  /

-- pipelined function 

create or replace function get_emp( p_deptno in number )
  return emp_table_type
  PIPELINED
  as
   TYPE EmpCurTyp IS REF CURSOR RETURN emp%ROWTYPE;
    emp_cv EmpCurTyp;
    l_rec  emp%rowtype;
  begin
    open emp_cv for select * from emp where deptno = p_deptno;
    loop
      fetch emp_cv into l_rec;
      exit when (emp_cv%notfound);
      pipe row( emp_scalar_type( l_rec.empno, LOWER(l_rec.ename),
          l_rec.job, l_rec.mgr, l_rec.hiredate, l_rec.sal, l_rec.comm, l_rec.deptno ) );
    end loop;
    return;
  end;
  /

select * from table(get_emp(20))

Tags: Database

Similar Questions

  • Function that would send email with body of select output

    Hello support,

    I want to create a function that would send an e-mail of this type

    BEGIN
    (flows_030100.wwv_flow_mail). Send
    p_subj = > 'test '.
    , p_body = > I WANT a SELECTION OUTPUT HERE :)))
    , p_from = > 'sender@mail '.
    , p_to = > 'recepient@mail '.
    );
    flows_030100.wwv_flow_mail.push_queue_background ();
    END;

    I need to output to select either a body of an email.

    Thank you in advance.

    You will need to use a cursor for loop, if you need to retrieve multiple records.

    create or replace function "MAIL_TEST"
    return VARCHAR2
    is
    l_body VARCHAR2 (32000);
    BEGIN
    for kurser in (
    select event_date, err_message into l_body from webseal where trunc(event_date)= trunc(sysdate-1)and err_message like '%locked%'
    ) loop
      l_body := l_body || to_char(kurser.event_date,'mm/dd/yy hh24:mi') || ' : ' || kurser.err_message || chr(10);
     end loop;
    
    flows_030100.wwv_flow_mail.send(
    p_subj => 'test'
    ,p_body => l_body
    ,p_from => 'sender'
    ,p_to => 'receiver'
    ,p_cc => 'receiver'
    );
    flows_030100.wwv_flow_mail.push_queue_background();
    return null;
    END;
    

    CITY

  • Trying to create a script that lists all clusters in a data center

    Hello

    I am trying to create a script that exports a vCenter configuration essentially and imports it in a new vCenter. I want the script to run without specifying a center of data manually. All the scripts I've seen you need to manually enter the data center.

    So, how to do a list of all the data centers with clusters in each of them? I also want to create a variable that contains the groups for the respective data centers. Here's a basic idea of what I want to do:

    $Datacenters = get-data center

    foreach ($Datacenter to $Datacenters)

    {

    $cluster = get-Cluster-location $Datacenter

    Write-Host "list of clusters in $Datacenters.

    Write-Host "$Cluster".

    }

    Who will give me the output like this:

    List cluster Datacenter1

    cluster2 CLUSTER1

    List cluster Datacenter2

    cluster3 cluster4

    But I don't know how I can get so I have variable like this:

    $datacenter1 = cluster1, cluster2

    $datacenter2 = cluster3, cluster4

    Did you mean something like this?

    Get-data center | %{

    New-Variable - Name $_. Name - value ([string]: join ("," (Get-Cluster-location $_ | % {$_.}))) Name})))

    }

  • I am trying to create a button that opens a pop-up window with a video player, sensible size. Also, I would like for the page Web of the background go darker when that happens. Is there a way top make in Muse?

    I am trying to create a button that opens a pop-up window with a video player, sensible size. Also, I would like for the page Web of the background go darker when that happens. Is there a way top make in Muse?

    Hello

    I created a video for you in Muse. Here is the link:- lightboxvideo.mp4 - Google Drive

    I hope that it would give you an idea on how to do just.

    Kind regards

    Rohit Nair

  • The columns appear in the data store that are not in the table

    Hi guru,.

    I have a table that I built in Oracle and added to ODI by refactoring it, but when I add it as a source to my interface, it contains columns that are not physically in the Oracle table that I can look into a TOAD. I dropped the prior of the table deleted-> interface-> reverse engineering table but I get an additional column. Y at - it an explanation for that? I have the table listed in a stored procedure - should I delete this step as well before reverse engineering, or is something else.

    Thanks in advance.

    Mike

    Yes. There is a possible explanation. How do you are engineering it? If you use Oracle RKM, you may be using a customized version of this KM which adds a column of your table name...

  • Trying to create a trigger that adds a value to a field based on another field

    Hello

    Im trying to set a trigger that will add a field to a table if another field = the same thing and one where the condition is met, but can't seem to get anything to do and can't find anything online suggesting the syntax.

    the use of im tables are

    Applications_History

    Students

    I need the trigger to identify if the 'status' field = applicant accepted when a new data column is added, if that is the case I need to identify the scope of student_number of applications_history and match it to the student_number on students field, I then need to add a 'Y' in the field 'put' corresponding to this student in the student table. I'm looking for without stopping for some type of syntax format online but could not find anything, is it still possible?

    Thank you

    Something like that?

    create or replace trigger aiur_applications_history

    after insert or update on applications_history

    for each line

    Start

    If nvl (: old.application_status, 'x'). = 'candidate admitted '.

    and: new.application_status = 'candidate admitted '.

    then

    students update

    the value = 'y '.

    where student_number =: new.student_number;

    end if;

    end;

    /

    Kind regards

    Zlatko

  • trying to create a clip that bounces off all four sides of the stage

    using the syntax below I have created a video called "BALL" bouncing to the left 'x' and moves to the right of the scene 'x.520' and bounces in the beginning 'x '.

    HOW CAN I CREATE A CLIP THAT BOUNCES OF THE FOUR SIDES OF THE STAGE AND STOPS ON THE BOUNCE FOURTH?

    var ballTween:Tween = new Tween (ball, "x", Bounce.easeInOut, ball.x, 520, 5, true);

    ballTween.addEventListener (TweenEvent.MOTION_FINISH, tweenFinishedF);

    function tweenFinishedF(e:TweenEvent):void {}

    new Tween(ball,"x",Bounce.easeOut,ball.x,0,5,true);

    }

    Thank you very much!!!

  • I am trying to create a page that resembles an Excel worksheet

    Is there an option in the Apex to create a page for entering data in a table that places the fields in a table, a bit like Excel format?

    In a table? The problem, you will need to insert a number of blank lines before time for the effect to type just data in lines. Perhaps based on a collection and insert a # all empty inside when lines filled?

    Thank you

    Tony Miller
    Webster, TX

  • How to create a hierarchy that is shared using the rules file.

    Hello - I am trying to create a shared in Essbase hierarchy that looks similar to the following

    -Member 1

    Member 2

    Member 3

    Member 4

    Member 5

    Member 6

    -Member 3

    Member 4

    Member 5

    Member 6

    Basically trying to shoot the 3 members 1 member hierarchy and show it separately.

    What my rule file should look like this situation.

    Grateful for the help.

    Thank you.

    Well, you can do that, as you describe because your member 3 would be a shared member and shared members cannot have children.

    you could do something like

    Member 3A

    Member 4

    Member 5

    Member 6

    Of course if you really want to watch a member 3 with his children, I don't understand why you need a shared hierarchy you can get the update rollup member 3 in the hierarchy of the primary

  • How to create a button that is persistent on the top of the Gallery HTML page

    Hello

    My InDesign folio, I have an article with photo gallery full HTML page. The photo grid occupies the full screen. I want to create a button that is persistent on top of this gallery, which the user can type to go to the main Menu page. This button is always visible in one place, even as the user scrolls up and down the gallery. I tried to create it on the top layer and the upper layer of the page master, but the button disapperas loading the HTML gallery.
    If the user does not see any button to navigate through the Gallery to another article.

    Any ideas how to create persistent button?

    Thanks in advance.

    -MP

    Why not do things just like an HTML article? You do it in the Muse.

  • EBS 11i - how to create a responsibility that can only reset the passwords

    Hello

    I need to create a responsibility of helpdesk team reset user passwords, but do not do. I created a menu and I tried "UMX_FORGOT_PWD", "UMX_OBJ_PASSWD_MGMT", "UMX_RESET_PWD" works but without hope. What should I do or how can I add more effort to make it work?

    user13014069 wrote:
    Yes, I meant this one. But it has everything, it can create, edit, close a user so I don't want to use this menu. I want to create a responsibility that questionable users and reset their passwords, that is, not can change anything else.

    For this you must use the customization to restrict who has access to this responsibility / to make all actions other than resetting the passwords.

    How to customize the forms [ID 468657.1]
    Information about the ability to customize the form of Oracle Applications 11i [ID 279034.1]
    Sample unit test for the use of form customization in Oracle Applications [ID 744069.1]
    Limits of customization of forms [ID 420518.1]

    Document personalization of forms
    Document personalization of forms

    Thank you
    Hussein

  • I am trying to create a photo book in Australia, but the College uses French and Euros. Can I convert in English and AUD?

    I'm about to order a photo book that I created in Photos. When I use the tab book buy the cost is in Euros and the information is in French. How I got all the English version and AUD?

    Do you live permanently in Australia?   Are - this Apple based on the use of an Australian bank with a supported by this bank credit card account?

  • I wan't to create a site that scrolls down, but the navigation widget allow me to add additional categories

    I want to create a unique page layout that scrolls down, but the questions that I have are these:

    (1) navigation widget don't allow me to add sections extra such as about me, contact me, etc. unless I have create or add additional pages, but I don't want to only a single page several pages. How can I get around this?

    (2) when I create anchor points, it allows me to add a hyperlink to a reason any? If I want the site to do scroll down to contact me, I create the anchor point, and then I click the tag navigation, about me and tie under the section of the hyper link, but it does not appear or is grayed out.

    Any help on this would be helpful.

    Thank you

    Adolfo

    Using the method of anchorage is correct. Just make sure that your Type of Menu is set to "manual".

  • Creating a button that takes you to the e-mail

    I have been posting tutorials in Muse left and right and have yet to see a definitive example of how to create a button that, when you click more open an email of the recipients with my e-mail address in the window "to THE.  It more or less contact me, but without the contact page.  If someone is on our Web page and want to contact us, clicking on Contact it will bring up their email with our email address in the window ' to THE '.  They then complete a question or simply request additional information in the areas of object copy and the body.

    Hello

    Muse allows you to create a link that opens a new blank message in the mail app by default of the user with the email already entered in the To: field.

    Watch this video

    Insertion of an e-mail link. Learn Adobe Muse CC | Adobe TV

    Please let me know if you have any other question.

  • Is it possible to create a button that goes back to the previous page?

    I would like to create a button that is located within an interactive pdf page which, when a click, turn to my previously visited page.

    As the page can be accessed through many other pages the traditional built in action menu does not Execute.

    The page that will appear (at the click of a button) is a variety of sizes of mattresses that I want to be accessible by each bed product in our collection. Once the user has looked at the mattress size guide, I want them to be able to back to bed product they were looking for, without having to then do scroll and search.

    Is this possible with tricks of javascript?

    I found this script:

    History.Go (-1);

    But allas acrobat was not fond.

    Help, please!

    Thanks in advance.

    Thanks for the tips!

    I already managed to do the navigation above methods with success.

    I have also since posting this message found the answer via a web document:

    http://cybertext.WordPress.com/2010/07/06/Acrobat-back-and-forward-buttons/

    It seems that if I told him to go to the previous view, it has the same effect as a "back" button.

    Thanks for the quick reply no matter!

    Oli

Maybe you are looking for