Using the function to retrieve several data

using the function recover data of the hre_date and name of entry where are employee_id = 100. kindly give a query in PLSQL

Padma... wrote:
Hello

create or replace function f1 (a number, b out varchar2) return date
is
c the date;
Start
Select last_name, hire_date b, c of the employees where employee_id = a;
return c;
end;
/
declare
name varchar2 (30);
Start
dbms_output.put_line (f1(100, name));
dbms_output.put_line (Name);
end;

Thank you
Padma...

Agree with Marwim, using OUT parameters is very bad practice.

Something would be more appropriate...

SQL> create or replace function get_emp(empno in number) return sys_refcursor is
  2    rc sys_refcursor;
  3  begin
  4    open rc for 'select hiredate, ename from emp where empno = :1' using empno;
  5    return rc;
  6  end;
  7  /

Function created.

SQL> var rc refcursor;
SQL> exec :rc := get_emp(7788);

PL/SQL procedure successfully completed.

SQL> print rc

HIREDATE             ENAME
-------------------- ----------
19-APR-1987 00:00:00 SCOTT

SQL>

If the customer requires a Ref cursor returned with data, otherwise a registration type / adapted collection could be returned and the integrated data to the that, although in general the collection of data in memory and the passage on the procedures is not the most ideal because it takes up resources such as memory of the PGA.
Without special requirements, it is impossible to give a precise answer.

Tags: Database

Similar Questions

  • I used the migration assistant to transfer data from my pc windows for my macbook pro, and it erased all my data. Is he here to retrieve these data

    I used the migration assistant to transfer data from my laptop to windows xp for my macbook pro OS X Yosemite 10.10.5 version and she erased all the data on my mac iTunes i.e., photos, documents, games, etc. Is it possible to recover these data or take it back to a State of pre migration? If not can I erase it and reload the software from scratch?

    Thank you

    Dave has

    You have a backup of Mac before moving the data from the PC?

  • need help on image blob retriving of table... I need to use the function

    I have a single display field and I tried to retrieve a value using the function... The idea of using the BLOB comes from the following example...
    http://dgielis.blogspot.in/2008/07/show-blob-of-other-table-in-apex-form.html

    I created the following function... has only function display.
    "return ' < img src =" "|" APEX_UTIL. GET_BLOB_FILE_SRC('P375_PICTURE',1204,,'inline') | '" />';

    but the output is undesirable character
    The output is the following
    < img src = "" apex_util.get_blob_file? a = 231 & s = 16387884076007 & p = 375 & d = 26249204291254605 & i = 26247831247254566 & p_pk1 = 1204 & p_pk2 = & p_ck = C226897F204BFA329F601AF2ED72ECDA & p_content_disposition = inline "/ >"

    Using apex 4.2 db 11g release 2 xe
    1204 here are a few magazine_id
    Here's my blob table structure
    xxx_picture
    xxx_no number (10),
    BLOB of photo
    picture_filename
    picture_mimetype
    image_last_update
    I am able to recover the data via interactivereport but I will lke to recover their data that show only the BLOB field

    Can someone please guide. . I could hurt
    Thank you

    Published by: zycoz100 on April 28, 2013 01:05

    zycoz100 wrote:
    I have a single display field and I tried to retrieve a value using the function... The idea of using the BLOB comes from the following example...
    http://dgielis.blogspot.in/2008/07/show-blob-of-other-table-in-apex-form.html

    I created the following function... has only function display.
    return '';

    but the output is undesirable character
    The output is the following

    To get a displayed item to render in HTML, in the definition section Security value escape special characters notitem.

    For a column of the report, ensure that the column attribute text to display as report is report Standard column rather than the default display text (escape special characters).

    However in the APEX 4.x, using an element in the Image display and support declarative BLOB is preferable to these manual methods. Images can be formatted using the HTML attributes of the element form of property, or via CSS element.

  • I want the single update query without using the function.

    I want to update sells_table selling_code field with product_code date product table max.
    In the product table, there are several product_code date wise.

    I did with below charly with the use of the service, but we can do in the query what a single update
    without using the function.

    UPDATE sells_table
    SET selling_code = MAXDATEPRODUCT (ctd_vpk_product_code)
    WHERE NVL(update_product_flag,0) = 0;

    (P_product IN VARCHAR2) RETURN of HVL.maxdateproduct NUMBER FUNCTION to CREATE or REPLACE
    IS
    max_date_product VARCHAR2 (100);
    BEGIN
    BEGIN
    SELECT NVL (TRIM (product_code), 0)
    IN max_date_product
    FROM (SELECT product_code, xref_end_dt)
    PRODUCT
    WHERE TO_NUMBER (p_product) = pr.item_id
    ORDER BY xref_end_dt DESC)
    WHERE ROWNUM = 1; -He'll be back a single line - max date product code
    EXCEPTION
    WHILE OTHERS
    THEN
    RETURN 0;
    END;

    RETURN max_date_product;

    END maxdateproduct;

    Thanks in advance.

    Hello

    Something like that.

    update setlls_table st
            set selling_code =(select nvl(trim(product_code)) from
                                  (select product_code
                                          , rank() over (partition by item_id order by xref_end_dt DESC) rn
                                       from product
                                   ) pr
                                   where rn =1
                                         and pr.item_id = st.ctd_vpk_product_code
                               ) where NVL(update_product_flag,0) = 0 ;
    

    That such is not tested due to lack of sampling input.

    Concerning
    Anurag Tibrewal.

  • Using the function PLSQL return Record Type Index of Tables in ADF

    I have a PLSQL function, a return type. My ultimate goal is to take this binary integer index Table and print it on the screen...

    CREATE OR REPLACE PACKAGE my_pkg IS
     
    TYPE t_col IS RECORD(
     
    i NUMBER,
     
    n VARCHAR2(30));
     
    TYPE t_nested_table IS TABLE OF t_col;
     
      FUNCTION return_table RETURN t_nested_table ;
    END my_pkg;


    OPTION 1:

    1) has anyone got best practices to accept plsql RECORDS returned by a function?

    Here is an example.

    http://adfpractice-Fedor.blogspot.SG/2013/01/working-with-PLSQL-procedures-in-ADF-BC.html

    But it will be a lot of work... first of all accept the results in a loop... then store in a temporary storage can be a few VO or global temporary table and then display them on the page


    OPTION 2:

    Using the functions PIPLELINED and use in the select statement.  While I can use this select statement in the SQL query to create VO... and drag and drop the VO...

    CREATE OR REPLACE PACKAGE my_pkg IS
     
    TYPE t_col IS RECORD(
     
    i NUMBER,
     
    n VARCHAR2(30));
     
    TYPE t_nested_table IS TABLE OF t_col;
     
      FUNCTION return_table RETURN t_nested_table PIPELINED;
    END my_pkg;


    select * from table(my_pkg.return_table);


    Wow... I'm so smart! .. really possible?  who is the best/possible/recommended option?

    I'm sure that will be the question most read by many who wants to use PLSQL instead of JAVA to the treatment and CHOSEN to use only to display the output of the PLSQL functions or procedures.


    Thank you

    Rahul


    Dario

    Do you mean the scope of the defined Type pkg will be finished?

    I created guy outside the pkg as 'Create Type' if it works in this case?

    Yes, level objects schema (created with "create or replace type...") can be used in java and this can work.

    I think that then the scope of this TYPE will remain until the user session passes.

    Object definitions is not worn, but have their bodies.

    So, if you instantiate the data level object type schema in a plsql function, scope of this object is this function.

    Of course, if you instantiate the object as a variable package, then life of this object is equal to the lifetime of the package (which usually equals life of session db).

    Dario

  • How to use the functions of SetValue executeScript activity.

    Hello

    Could someone let me know how to use the function activity setValue (serialize concate, count etc) in activity executeScript. What all liberaries I need to import to executeScript. I want to perform the same task in executeScript performed in the setValue activity.

    Concerning

    Sunil Gupta

    Forgive me if I seem obtuse, but why would you use XPath functions (is that serialize, concat, and count) when there are perfectly good Java alternatives that will be much easier to use.  Java is, after all, the language used in the executeScript.  Serialize is just toString(), CONCATENATE is just + or. concat() (I assume that you are running on Java 6 web application server).  The count function is just the length() or size() methods or to the tables, the length property.  If you really need to reorganize in a variable of the XML data using a XSL stylesheet - you have access to all the functions in XPath 1.0 and XPath 1.0 power and you do not need to tinker with the headache of trying to debug Java in an environment (Workbench), which does not give you the tools that you would normally , as a contextual Editor.

  • Create the view and by using the function that returns a type oracle

    Following is possible?

    A function returns an ORACLE object Type, and I want to use this feature, in my opinion, it is possible to access each field of the type once the function is executed and make a column in the view?
    create or replace TYPE SOME_INFO AS OBJECT
    ( 
      CHARGE FLOAT,
      SOME_DATE DATE,
      SOME_VAL VARCHAR(50)
    );
    
    CREATE OR REPLACE
      FUNCTION CALCULATE_INFO
        (
          p_chargeId NUMBER)
        RETURN SOME_INFO 
      AS 
      v_some_info SOME_INFO := new SOME_INFO(0, null, null);
    BEGIN
     
    -- function body populates the v_some_info
    return v_some_info;
     
    END calculate_info;
    Now, I want to use the function according to me - if the underlying query of the view follows-
     select c.*, calculate_info(c.charge_id) as someInfo from some_charge;
    How to recover someInfo.CHARGE, someInfo.some_date, someInfo.some_val? I can put them as columns in the view?

    If you use only functions that return a single value in a view?

    Thank you
    Mustapha

    Published by: Tina Giri on April 16, 2009 05:47

    How to recover someInfo.CHARGE, someInfo.some_date, someInfo.some_val?

    SQL>  create or replace type some_info
    as
       object (charge float, some_date date, some_val varchar (50));
    /
    Type created.
    
    SQL>  create or replace function calculate_info (p_chargeid number)
       return some_info
    as
       v_some_info   some_info := new some_info (0, null, null);
    begin
       -- function body populates the v_some_info
       return v_some_info;
    end calculate_info;
    /
    Function created.
    
    SQL>  select your_view.someinfo.charge,
           your_view.someinfo.some_date,
           your_view.someinfo.some_val
      from (select c.*, calculate_info (c.empno) as someinfo
              from emp c) your_view where rownum <= 3
    
    SOMEINFO.CHARGE SOMEINFO SOMEINFO.SOME_VAL
    --------------- -------- --------------------------------------------------
                  0
                  0
                  0                                                            
    
    3 rows selected.
    
  • I have an iMac 27' 2012 with macOS Sierra and Apple Watch with watch OS 3, I can use the function "Log?" in Apple Watch

    I have an iMac 27' 2012 with macOS Sierra and Apple Watch with watch OS 3, I can use the function "Log?" in Apple Watch

    Hi John 2078 Tito.

    I understand that you have updated your iMac and Apple Watch and now you're curious about unlock your iMac using your Apple Watch. I know that it is a nice feature to be able to quickly and safely unlock your computer, so I'm happy to help you.

    This feature is available on 2013 iMacs and later versions, which means that your iMac won't be compatible. You can see more info on this feature here:
    Unlock your Mac with Apple Watch - Apple Watch user's Guide

    Thank you for using communities Support from Apple. See you soon!

  • I have been using the functionality of Firefox in which I could have multiple sets of tabs open, but only see the game I was working with. I have updated and now the functionality is Gone

    I have been using the functionality of Firefox in which I could have multiple sets of tabs open, but only see the game I was working with. I have updated and now the feature disappeared. I had a small icon on the top right of my toolbar. I used it all the time to keep windows separated for financial, plans to travel items, news, etc.. Has it been removed from Firefox?

    Hello

    The feature of tab groups is always present. You can try with the button right of the + after the last tab and Customize. If the icon is hidden behind the other, or if it is available inside the mini window customize, you can put it back. If the problem persists, you can also try of reset toolbars and controls: and start to make changes and restart in Safe Mode screen.

  • Using the functionality of Panorama on the DSC - H55

    What is the best technique to use the functionality of panorama Cybershot DSC - H55, press and hold down the button while slowly following the arrow or press and release the button? Move from L to R very slowly or quickly?

    HI, you have limited play with the speed as you move the camera a little to get used to the speed. I know it sounds strange, but it takes a little getting used to for you to know how fast to move it to. If you move too slow or too fast, you will not receive either the scene or the camera will tell you to slow down. If you can't move the camera through any matter within the time limit, a grey zone occurs in the composite image. In this case, go faster the camera to record a complete panoramic image.

    To take the panorama photo, you can press the button all the way down and release, then move the camera in the direction of the arrow. The camera records for about 7 seconds.

  • Cannot use the functions F1-12 on my Satellite C55 - A - 19 K

    Hello

    Satellite C55 - A - 19 K have a keyboard drivers?
    I cannot use the functions F1-12 and can not get the wireless since it s on the keyboard...
    Any 1 can help please?

    This function is not controlled by the driver keyboard, but with utilities and tools specific to Toshiba.
    What operating system do you use?

  • I use Windows 10 and use the Canon SX20 IS. How to use the function of Photo stich?

    I use Windows 10 and use the Canon SX20 IS. How to use the function of Photo stich?

    Is it possible to get the procedure to use feature stich photo?

    Will be Zoombrowser EX for windows 10 wotk?

    If any expert can guide me... that will be great.

    Hi Sat17,

    Thank you for your inquiry.

    For Windows 8 and beyond, ZoomBrowser EX has been replaced by EX. ImageBrowser

    Your software you will need to updated for Windows 10.

    You can access the software for your camera by clicking here.  Once on our site, scroll down to "Drivers and downloads", then use the drop down menu to choose "8.1 Windows" or "Windows 8.1 (x 64)".»  Your camera software has not been updated for Windows 10, but for Windows 8.1 software will run on your computer.

    To update your software, click the [Select] button to the right, then click on "How to download and install" for installation instructions.

  • Need help in using the ActiveX to retrieve a VARIANT

    Need help in using the ActiveX to retrieve a VARIANT.

    Variant is shown as var {VT_Ul1, 1} in debugging

    By using the following

    HR = CA_VariantGetShort (& var, &value);)

    I get 0 for my answer instead of 1.

    Answered my own question.

    VT_Ul1 is an unsigned char and not a short.

  • I have saved via a website magazine and am now unable to disconnect! It is an interactive Web site, and I am unable to use the functions, so want to close your session, as there is no button 'unsubscribe '.

    I have saved via a website magazine and am now unable to disconnect! It is an interactive Web site, and I am unable to use the functions, so want to close your session, as there is no button 'unsubscribe '. Thanks for any info provided.

    You should contact the website of the magazine for assistance.  This isn't a Windows, or a problem of Microsoft.

  • Color image is not displayed when we call using the function DAL (LOGO)

    Hi all

    To change a picture of the legacy of the new Image in our MRL, the legacy Image is used by a lot of Faps (sections).

    (1) if we create the new article with new Images, the process becomes complex, as we need to check all the triggers and forms associated with it.so, we plan to create a field (with the same position as picture) DAL with functions of LOGO use

    EX:

    If (#process = 1)

    LOGO ("Idea", Fieldx (), Fieldy ())

    on the other

    LOGO ("LegacyImage", Fieldx (), Fieldy ())

    End

    Return("")


    Problem: The new Image is colored but when printed (called using "DAL") that is the impression that 'Black and White')

    We tried to use 'Refresh() '.


    Kindly help me with solutions,


    Thanks in advance

    Try to use the function ChangeLogo DAL instead.

    Change a logo on a section that has the set of attributes "print in color.

    This preserve the parameter "Print in color" and the logo print in color.

    See Re: how to get the graph to print in color when it is added using script

Maybe you are looking for