Why Table function is not allowed on the collections defined in PLSQL?

We all know that we can use the function table on collections defined as database object type. Why cant Oracle provide this function for defined collections in PLSQL?

For prior 12c version you can play around with pipelined functions.

SQL> create or replace package emppkg
  2  as
  3    type rec is record (empno integer, ename varchar2(100));
  4    type tbl is table of rec;
  5
  6    function get (pdeptno in integer) return tbl pipelined;
  7  end;
  8  /

Package created.

SQL> show err
No errors.
SQL> create or replace package body emppkg
  2  as
  3    function get (pdeptno in integer) return tbl pipelined
  4    is
  5       lrec rec;
  6    begin
  7       for i in (select empno, ename from emp where deptno = pdeptno)
  8       loop
  9          lrec.empno := i.empno;
 10          lrec.ename := i.ename;
 11          pipe row(lrec);
 12       end loop;
 13
 14       return;
 15    end;
 16  end;
 17  /

Package body created.

SQL> show err
No errors.
SQL> select * from table(emppkg.get(10));

     EMPNO ENAME
---------- --------------------
      7782 CLARK
      7839 KING

SQL> select * from table(emppkg.get(20));

     EMPNO ENAME
---------- --------------------
      7369 SMITH
      7566 JONES
      7788 SCOTT
      7876 ADAMS

SQL> select * from table(emppkg.get(30));

     EMPNO ENAME
---------- --------------------
      7499 ALLEN
      7521 WARD
      7654 MARTIN
      7698 BLAKE
      7844 TURNER

SQL>

Tags: Database

Similar Questions

  • A SQL server management studio 2012 error: PERCENTILE_DISC function is not allowed in the current compatibility mode. It can only in mode 110 or higher.

    Our company just upgraded to SQL Server Management Studio 2012 and it has been very useful because I needed to use the percentile for the code I wrote. As a first step, the function did not work because I set the compatibility mode 110 level. After that I did, the function worked. However, now it does not work yet, and I get the same error:

    The PERCENTILE_DISC function is not allowed in the current compatibility mode. It can only in mode 110 or higher.

    I went to the properties of database section, then options and noticed that the compatibility mode has not changed, it is set to "SQL Server 2012 (110). I even used the following code to see if that would help at all even if the compatibility mode is already on this mode:

    ALTER DATABASE Analytics
    SET COMPATIBILITY_LEVEL = 110 
    

    Someone already had this problem or knows if I need to change something in the properties of database for this function work? Is this just a bug in the new version?

    Hello

    I suggest you post this question in the SQL Server 2012 TechNet Forums: http://social.technet.microsoft.com/Forums/en-us/category/sqlserver

    Thank you.

  • Can you tell me why I'm received not allowed to modify a pdf file when I file creater?  I received the question as surity?

    cantrxoraqi9 you tell me why I'm received not allowed to modify a pdf file when I file creater?  I received the question as surity?

    
    

    If a form has been made with LiveCycle Designer, it can only be edited in LiveCycle Designer. This is a permanent restriction, there is no course Acrobat. It is not a security problem.

    LiveCycle Designer forms cannot be made available as far as I know (but I could be wrong here).

    If repeat you a similar content to PDF format, there is no way to reintegrate into the designer. You cannot mix the tools in this way. It is possible in LiveCycle Designer, or it is not possible at all.

  • When you use Device.device.os, it throws error #1079: native methods are not allowed in the loaded code.

    Hi all

    When I tried to use the Device.device.OS to get the string from the bone. It is compiled smoothly. But it throws error when the application started on my desk.

    Error #1079: Native methods are not allowed in the loaded code.

    It does not error in the emulator, but he did not get the chain of the OS.

    Someone knows how to use the device class? Is it still not currently supported?

    Thank you very much!

    Error #1079: Native methods are not allowed in the loaded code.

    This error is thrown on the desktop because your qnx - air.swc is probably in the process of fusion as code instead of being tied to your project as external. The reason who need to be external is that it contains classes that exist in the execution of AIR in the Simulator and not in the AIR runtime on your desktop. The device classes use the custom air extensions we wrote to get the properties of the device.

    If you want just the operating system, you can also use the Capabilities.os, which is a standard API Flash Player and does not require the use of custom extensions.

    My guess on why it does not work on the device thus is that the qnx - air.swc is not defined externally. Return to externally set and run it in the Simulator.

    Hope that helps

    Julian

  • Error creating - snapshot operation is not allowed in the current state

    Hi all

    Using Veeam Backup & Recovery 6 software to replicate a LIVE VM (virtual MACHINE, 1). But I can't and I got the following error:

    Error creating - snapshot operation is not allowed in the current state

    The above virtual machine can only be copied when it is STOPPED the VM is running on ESXi 4.0.

    I have a more LIVE VM (virtual MACHINE, 2) on the ESXi Host which I was able to replicate successfully to another ESXi host.

    I contacted the Veeam Support before posting here.

    Things to note about VM 1: I can't take a snapshot manually from the vSphere client. This option is greyed (disabled) on VM1... While its OK on VM2.

    Veeam support told me that since its software uses the snapshot function of ESXi and this feature is disabled, replication cannot continue.

    Thanks for helping me on this.

    Exactly what I thought. When you delte this PCI passtrough your Backup Exec tape will not longer work.
    You will not be able to do replication when you use this passtrough.

    Only solution for replication (which is what I think you want for purposes of disaster) is to install a 3rd VM (or as physical) as "Backup Server" where you install Backup Exec and enable PCI-Passtrough to your tape drive. Then this new virtual machine with Backup Exec backup.

    After that you can delete the passtrough of your SBS and your replication will work.

    Sorry

    Concerning

    Simon

  • Synchronization problem; Functions do not execute in the order specified

    I have a timing problem. Three functions are called
    in this order:

    InsertMenu();                  Inserts a record in the menu in the database
    getLastRecordId();           Gets the primary key of the inserted record just menu
    Stores recovered key in a textTextInput control
    PrepareMenuItemInsert(); Keys to textInput saved readings
    Inserts a menu item record, affecting a link
    menu using the stored key file

    Everything works but at the point when the PrepareMenuItemInsert() function
    runs, the textInput control has not yet been updated by the getLastRecordId()
    function and is empty. The link to the menu file will eventually be set to 0.

    Of course these functions run not sequentially in the order specified.

    Is there a way I can force the order or do the PrepareMenuItemInsert()
    function of wat up to what getLastRecordId() wrote the key value in the
    textInputControl?

    Scott

    I well enough to use SQL Server and ColdFusion to manage my data back-end and treatment, but the methodology is basically the same.  The methodology I use is as follows.

    Since Flex: Launch the call to write the data to the database (you have it already).  In Flex, make sure that the call to write the data expects a return value (string, int or a table) of the call.  You have too much already, but it is associated with the GetLastID() call.  These data must be returned from the call to the insert.  After you receive this value then you call the following sequence in the chain of events.  I gave examples of how make that call in Flex in the previous post.

    In the back-end processing: you receive the values from Flex to add to the database, I call them ValInt_1 and Val_Str_2 in the example below.  Place a lock on the database to ensure that only one instance of your application can write to the database at a given time.  Insert the data into the database. Get the value of the new PK of the database and place it in a variable. Release the lock that commit data in the database.  Return the variable.  In the CF, this is how I would do...

    INSERT INTO MyTable (ValInt_1, ValStr_2)

    VALUES (,

    )

    SELECT Max (DataCnt) as MyMax

    FROM MyTable

    Bottom line is writing data and return of the new PK is a flex appeal, a call that expects a value returned from your backend processing.  It's the return of the call to the database where you manage your sequence of events.  Do not forget that a call to any object or function in Flex seems to trigger its own thread, so the timing is not sequential at that time.  So, for me at least, the trick is to sequence the calls to other events and if the calendar is dependent on an event called the following sequence must then be moved to this call.  I.E. If the point C of the sequence cannot be run until it has and B are both done I followed this method:

    private function Set_A (): void {}

    DoStuff_for_A;

    Call_B (PassNeddedVars):

    }

    private Set_B(YourPassedVars:YourTypeAsNeeded):void {} function

    DoStuffFor_B (YourPassedVars);

    Call_C (PassNeededVarsForC);

    }

    private Set_C(YourPassedVars:YourTypeAsNeeded):void {} function

    DoStuffFor_C (YourPassedVars);

    }

    I know it's pretty generic, but sometimes it's easier...

    Have an ordinary day...

    KomputerMan ~ |  :-)

  • Why wireless keyboards are not compatible with the Apple TV (4th generation)?

    Why wireless keyboards are not compatible with the Apple TV (4th generation)?  Similarly, why didn't the App compatible with Apple TV Remote (4th generation)?  They will be in the future?

    No one here knows why Apple have so far decided not to support Bluetooth keyboards, or if they are likely to do so in the future. The iOS app is compatible with the 4 ATV in its latest version (4.2.3) - https://itunes.apple.com/gb/app/remote/id284417350?mt=8

  • HTTP: Error 58 (the network function is not supported by the system)

    Hi all

    I have a problem with HTTP Client in LV 2011 functions.

    As you can see in the screenshot attached, I try just:

    -Open a handle-> no errors

    -Send a web request using the GET method-> error 58

    -close the handle

    The problem is that a 58 error: "the network function is not supported by the system. However, it works fine when I type the same URL in a web browser.

    You have any idea of what could be the problem? Thank you in advance for your help!

    J.

    I have fixed the bug: there was a white at the beginning of the URL... (!!!). I deleted the empty character and now it's OK.

  • Operation not allowed on the shipment blocking event thread

    Dear friends,

    I'm sorry to put this problem, but I'm posting it after much searching this forum. Although the number of threads, the solution is available, but it does not work on me. On a thread, that the person wrote that he solved the problem, but haven't posted the solution how he had done this. The problem is:

    SerializableAttribute public class SmsDemo extends net.rim.device.api.ui.UiApplication {}
    Private SmsDemoMainScreen SmsDemoMScreen;
    Public Shared Sub main (String [] args)
    {

    SmsDemo SmsDemoApp = new SmsDemo();
    SmsDemoApp.enterEventDispatcher ();
    }
    public SmsDemo()
    {
    _Thread BackGroundThread = new BackGroundThread();
    _Thread.start ();

    SmsDemoMScreen = new SmsDemoMainScreen();
    pushScreen (SmsDemoMScreen);
    }

    class BackGroundThread extends Thread {}
    public BackGroundThread() {}
    / * initialize the constructor parameters * /.
    }

    public void run() {}
        
    net.rim.device.api.ui.UiApplication.getUiApplication () .invokeLater (new Runnable()
    {
       
    public void run() {}
                   
    try {}
    javax.wireless.messaging.MessageConnection msgConn = (javax.wireless.messaging.MessageConnection)javax.microedition.io.Connector.open("sms://:0");
    javax.wireless.messaging.Message msg = msgConn.newMessage (javax.wireless.messaging.MessageConnection.TEXT_MESSAGE);
    javax.wireless.messaging.TextMessage = (javax.wireless.messaging.TextMessage) msg txtMsg.
    txtMsg.setAddress("sms://+91123456789");
    txtMsg.setPayloadText ("Test Message");
    msgConn.send (txtMsg);
                       
    System.out.println ("sending SMS success!");
    } catch (Exception e) {}
    System.out.println (e.getMessage ());
    e.printStackTrace ();
    }
    }
    });
          
    }
    }

    The code above gives error "Blocking Operation not allowed on the event dispatch thread" to msgConn.send (txtMsg); line.

    Please guide me how to solve the problem for example. If possible, please guide me how to continuously listen to the incoming message also. The SmsDemo example with JDE is autonomous work fine but in error when incorporated in my solution.

    Thanking you in anticipation.

    I don't think you need to do invokeLater (new Runnable()... the inner thread.) Try to remove it, I think that this can cause this problem.

  • "The operation is not allowed in the current state" message when you delete the folder

    I'm test ESXi 5.5 and mounted a datatsore of oriented export NFS in an attempt to redirect my ScratchConfig at this place. I found that I can create a folder in the datasore NFS fine but when I try to delete it, I get a message saying "the operation is not allowed in the current state. This happens on any of the files/sub-sub-sub-folders and only used account's root - I also confirmed that these directory drwxr-xr-x permissions.

    As suggested by KB1003829 which is a bit useful, but not really, I restarted the management on the host agents but it made no difference. Has anyone else seen elsewhere?

    I got this resolved, stumbling on the good guid for the NFS data store. Only after clicking around in WinSCP and realize that the NFS data store guid secondary, shorter - I then tried again to remove the original test directory and it worked.

    On a separate but similar note, then I tried to update my position zero config by applying this same guid with the command "vim - cmd hostsvc/advopt/updated updated ScratchConfig.ConfiguredScratchLocation string vmfs/volumes / [guid] / logs" (followed by a restart of the host) and it worked also.

  • vSphere HA is inside in vain. Operation is not allowed in the current state.

    Hello

    I'm testing vSphere HA with two hosts ESXi in my lab. I have a VM on each ESXi host and when I try to open HA by closing the port connection from the switch to one of the hosts, the cluster of vSphere tries to failover of the VM on the host failed to another host, but he is not successful.

    The events under the Cluster gives this warning:

    vSphere HA switched in vain < VM - > < Home > cluster < cluster name>. vSphere will try again if the maximum number of attempts has been exceeded. Reason: The operation is not allowed in the current state.

    Screenshot of the error is attached.

    I tried to restart the service of server vCenter and that did not help. What could be wrong here?

    Thank you.

    Shivani

    Hello adel.

    Do not disable the HA data store. If you have a physical server just power the server by pulling the power plug or just it crash. If you have virtual server vESXi, and then directly 'Power Off' there instead of the stop.

  • Unable to connect to the MKS: the operation is not allowed in the current state

    Hi all

    After the upgrade of vmware tools, we have a problem while safeguarding a guest vm with avamar. VM freezes and he said; "Unable to connect to the MKS: the operation is not allowed in the current state.  It can be stopped only by killing the task in the service on the host esx console.

    VMware vCenter Server 5.1 - 5.1.U1b - 1235232

    2013 12-19 T 00: 49:15.146Z | vCPU-1 | W110: MONITOR PANIC: vcpu - 0:NOT_IMPLEMENTED devices/vide/iovmk/videVMK-vmkio.c:1492

    2013 12-19 T 00: 49:15.156Z | vCPU-1 | I120: Core dump with construction build-1065491

    2013 12-19 T 00: 49:15.156Z | vCPU-0 | I120: Exit vcpu-0

    2013 12-19 T 00: 49:15.156Z | vCPU-1 | W110: Writing monitor corefile "/ vmfs/volumes/4ff12f8d-9d4d7a89-9341-e4135bb796b4/TEADEV/vmmcores.gz".

    2013 12-19 T 00: 49:15.202Z | vCPU-1 | I120: Save the anonymous memory

    2013 12-19 T 00: 49:15.209Z | vCPU-1 | W110: Dumping core for vcpu-0

    2013 12-19 T 00: 49:15.209Z | vCPU-1 | I120: CoreDump: dumping core with superuser privileges

    2013 12-19 T 00: 49:15.209Z | vCPU-1 | I120: VMK battery for vcpu 0 is 0 x 412248155000

    2013 12-19 T 00: 49:15.209Z | vCPU-1 | I120: Start monitor coredump

    2013 12-19 T 00: 49:16.454Z | vCPU-1 | I120: End monitor coredump

    2013 12-19 T 00: 49:16.455Z | vCPU-1 | W110: Dumping core for vcpu-1

    2013 12-19 T 00: 49:16.455Z | vCPU-1 | I120: CoreDump: dumping core with superuser privileges

    2013 12-19 T 00: 49:16.455Z | vCPU-1 | I120: VMK battery for vcpu 1 is at 0x4122481d5000

    2013 12-19 T 00: 49:16.455Z | vCPU-1 | I120: Start monitor coredump

    2013 12-19 T 00: 49:17.420Z | vCPU-1 | I120: End monitor coredump

    2013 12-19 T 00: 49:17.421Z | vCPU-1 | W110: Dumping extended monitor data

    2013 12-19 T 00: 49:31.966Z | vCPU-1 | W110: A core file is available in "/ vmfs/volumes/4ff12f8d-9d4d7a89-9341-e4135bb796b4/TEADEV/vmx-zdump.000".

    2013 12-19 T 00: 49:31.966Z | vCPU-1 | I120: Msg_Post: error

    2013 12-19 T 00: 49:31.966Z | vCPU-1 | I120: fatal error [msg.log.error.unrecoverable] VMware ESX: (vcpu-1)

    2013 12-19 T 00: 49:31.966Z | vCPU-1 | I120 + vcpu - 0:NOT_IMPLEMENTED devices/vide/iovmk/videVMK-vmkio.c:1492

    2013 12-19 T 00: 49:31.966Z | vCPU-1 | I120: [msg.panic.haveLog], a log file is available in "/ vmfs/volumes/4ff12f8d-9d4d7a89-9341-e4135bb796b4/TEADEV/vmware.log".

    2013 12-19 T 00: 49:31.966Z | vCPU-1 | I120: [msg.panic.requestSupport.withoutLog] you can ask support.

    2013 12-19 T 00: 49:31.966Z | vCPU-1 | I120: [msg.panic.requestSupport.vmSupport.vmx86]

    2013 12-19 T 00: 49:31.966Z | vCPU-1 | I120 + to collect data to be submitted to the technical support of VMware, run 'vm-support.

    2013 12-19 T 00: 49:31.966Z | vCPU-1 | I120: [msg.panic.response] we will respond on the basis of your entitlement to support.

    We realized that the problem is our url filtering service checkpoint firewall. When we have disabled all begins to work very well.

  • The submenu stack does not allow for the pictures stacked in the Organizer features 13 8.1 on windows

    The submenu stack does not allow for the pictures stacked in the Organizer features 13 8.1 on windows.

    Everyone knows this?

    I stacked a few photos, now I can't develop or desempilement them in the Organizer.

    This is for auto and manual of stacking.

    stacking.png

    Please press Ctrl + D to go to the older grid, and now the battery option must be enabled.

    Thank you
    Blandine

  • Why channel Volume does not appear in the Panel of the applied effects (first 12 elements trial version)?

    Hi people

    doew anyone know why Channel Volume does not appear in the Panel of the applied effects (first 12 elements trial version)?

    Thank you very much in advance

    Adam

    adamPREMIERE

    I have the book, but this screenshot has been extremely help.

    The answer is...

    Like I said, the default Panel in the range of effects of applied effects/Applied / Motion and opacity.

    Once you apply fx effects Audio/Effects/Channel Volume effect to your audio clip, you will see the channel Volume Panel in the Palette of effects applied and the movement and opacity.

    I'll give you screenshots if necessary.

    Please try to prove guilt.

    Thank you.

    RTA

  • Subtract operation is not allowed on the parking METER, INTEGER operands to appeal

    I'm running a weird problem that I've defined a formula in the RPD to calculate the service life. When I bring this column with any other column made it gives me error: subtract operation is not allowed on the parking METER, INTEGER operands to appeal

    But if I set the same calculation in answers using the formula edit column it works very well. I need to define in the SPR for the column to be present for ad-hoc. Where is my mistake?

    Definition of the answers: case when "job events (Previous). "Rental Date #1" > ifnull ("job events (Previous)" "." ")" Date expression","job events (previous). "Rental Date #1") then cast (floor (case when "job events (Previous)". "))" "Rental Date #1" > ifnull ("job events (Previous)" "." ")" Date expression","job events (previous). "Rental Date #1") then the case when 'Employment events (Previous)' "." " Rental Date #1 "is not not null then TIMESTAMPDIFF (SQL_TSI_MONTH, 'Employment events (Previous)'". ")" Rental Date #1 "(, CURRENT_DATE) ELSE NULL END ELSE NULL END 12) as char) |' year (s) ' |" Cast (Mod (case when "job events (Previous)" "." ")) Rental Date #1 "> ifnull (" job events (Previous) "". "") " Date expression","job events (previous). "Rental Date #1") then the case when 'Employment events (Previous)' "." " Rental Date #1 "is not not null then TIMESTAMPDIFF (SQL_TSI_MONTH, 'Employment events (Previous)'". ")" Rental Date #1 "(, CURRENT_DATE) ELSE NULL ELSE NULL END, 12) as char) |' months ' end of another null"


    SPR: case when "Core". «Fact - job events ".» "" Date of hire "> IfNull ('Core'. «Fact - job events ".» "' End Date ', 'basic '. «Fact - job events ".» "Rental Date"(-1) then "
    Cast (floor (case when "basic".)) «Fact - job events ".» "" Date of hire "> IfNull ('Core'. «Fact - job events ".» "' End Date ', 'basic '. «Fact - job events ".» "Rental Date"(-1) then "
    case when "Basic." «Fact - job events ".» "' Rent ' is not null then TIMESTAMPDIFF (SQL_TSI_MONTH,"basic". «Fact - job events ".» (' ' Hiring date ', CURRENT_DATE) else null
    end
    Another null
    END/12) as char) |' year (s) ' | Cast (Modcase what of"basic". «Fact - job events ".» "" Date of hire "> IfNull ('Core'. «Fact - job events ".» "' End Date ', 'basic '. «Fact - job events ".» "Rental Date"(-1) then "
    case when "Basic." «Fact - job events ".» "' Rent ' is not null then TIMESTAMPDIFF (SQL_TSI_MONTH,"basic". «Fact - job events ".» (' ' Hiring date ', CURRENT_DATE) else null
    end
    Another null
    END, 12) as char) |' months '
    otherwise null end

    Help, please!

    Try this: -.

    case when "Basic." «Fact - job events ".» "" Date of hire "> IfNull ('Core'. «Fact - job events ".» "" Date of term ", TIMESTAMPADD (SQL_TSI_DAY,-1,"Core". "Fact - job events". "" Rental Date"))
    then
    Cast (floor (case when "basic".)) «Fact - job events ".» "" Date of hire "> IfNull ('Core'. «Fact - job events ".» "" Date of term ", TIMESTAMPADD (SQL_TSI_DAY,-1,"Core". "Fact - job events". "" Rental Date")) then
    case when "Basic." «Fact - job events ".» "' Rent ' is not null then TIMESTAMPDIFF (SQL_TSI_MONTH,"basic". «Fact - job events ".» (' ' Hiring date ', CURRENT_DATE) else null
    end
    Another null
    END
    ((/ 12) as char) |' year (s) ' | Cast (Modcase what of"basic". «Fact - job events ".» "" Date of hire "> IfNull ('Core'. «Fact - job events ".» "" Date of term ", TIMESTAMPADD (SQL_TSI_DAY,-1,"Core". "Fact - job events". "" Rental Date")) then
    case when "Basic." «Fact - job events ".» "' Rent ' is not null then TIMESTAMPDIFF (SQL_TSI_MONTH,"basic". «Fact - job events ".» (' ' Hiring date ', CURRENT_DATE) else null
    end
    Another null
    END, 12) as char) |' months '
    otherwise null end

Maybe you are looking for