Why I Can't use procedure in select statement

Why I Can't use procedure in select statement

We can use function in select statement but we couldn't use procedure with one out parameters in select statement... You can use Function because they are designed for this but procedure are not. Functions can return value (without OUT parameter) which can be used in SELECT whereas procedures do not have such concept. As you can see in the above post you can not call even functions also if it has any out parameter.
I have just trying to use procedure in select statement ..for this I require technical answer..The technical answer is because conceptually procedure is for doing set of operation, performning DMLs on the tables , whereas functions are for processing and producing a single result. Functions are basically for not using INSERT/UPDATE/DELETE in it. That is the reason they are allowed to be used in SELECT because conceptually they are not supposed to do any data changes.
Regards,
Avinash

Similar Messages

  • Using procedure in SELECT statement

    I have a select statement that currently uses 4 functions to receive necessary values. All the functions are recursive and returns values from the same row.
    What I would like to do is replace these for function calls with 1 procedure. Does anybody know if it possible to use a procedure in this way inside a select statement?
    If so, do you have the syntax for doing this?
    E.g
    SELECT
    Mdbrd_Pkg.calculate_fixed_charge_fn(in_rc_id, ap.CONFIGSET_ID) AS FIXED_CHARGE,
    Mdbrd_Pkg.calculate_charge_rate_fn(in_rc_id, ap.CONFIGSET_ID) AS CHARGE_RATE,
    Mdbrd_Pkg.tax_liable_fn(in_rc_id, ap.CONFIGSET_ID) AS TAX_LIABLE,
    Mdbrd_Pkg.charge_unit_fn( in_rc_id, ap.CONFIGSET_ID) AS CHARGEUNIT_ID
    FROM .....

    This cannot be done. The part of the function used in the SELECT statement is the return value: procedures don't have return values (that's what makes tham procedures and not functions).
    Obviously I don't know what your code does, but you should consider putting them into a single function that returns a TYPE with four attributes and then using the TABLE() function to cast them into something you could reference in the FROM clause of a correlated sub-query. Sounds a bit messy though.
    Do these functions actually select data? Where does the recursion fit in?
    Cheers, APC

  • How many columns can be used in the SELECT Statment

    Hi all,
    How many columns can be used in the SELECT statement?
    Ex: SELECT x1,x2,....xn FROM <table_name>;
    Thanks,
    GowriShankar.N

    Let me join ;-)
    SQL> select * from v$version;
    BANNER
    Oracle9i Enterprise Edition Release 9.2.0.6.0 - Production
    PL/SQL Release 9.2.0.6.0 - Production
    CORE    9.2.0.6.0       Production
    TNS for Linux: Version 9.2.0.6.0 - Production
    NLSRTL Version 9.2.0.6.0 - Production
    SQL> DECLARE
      2  l_sql varchar2(32000);
      3  begin
      4  l_sql := 'CREATE TABLE T(';
      5  for i in 1..999 loop
      6  l_sql := l_sql ||'C'||i||' NUMBER,
      7  ';
      8  end loop;
      9  l_sql := l_sql||'C1000 NUMBER)';
    10  EXECUTE IMMEDIATE l_sql;
    11  end;
    12  /
    PL/SQL procedure successfully completed.
    SQL> select count(*) from cols where table_name = 'T';
      COUNT(*)
          1000
    SQL> insert into t(c1) values(1);
    1 row created.
    SQL> select *
      2  from t t1,t t2;
            C1         C2         C3         C4         C5         C6         C7         C8         C9       
    ...   snipped
    C991        C992       C993       C994       C995       C996       C997       C998       C999         C1         C2         C3       C4         C5         C6         C7         C8         C9        C10       
    ...   snipped
    C990       C991       C992       C993    C994        C995       C996       C997       C998       C999
    ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ----------          1
                                                                                                                                        1
    SQL>
    SQL> select count(*) from (
      2  select * from t t1,t t2)
      3  ;
    select * from t t1,t t2)
    ERROR at line 2:
    ORA-01792: maximum number of columns in a table or view is 1000Obviously, inline view is obliged the same restrictions as a view, but select list is not constrained.
    Best regards
    Maxim

  • Error by using database procedure in select statement

    hi ,
    I have built a database procedure having one parameter with in out varchar type. that return value with some addition.
    i am using it with some column in select statement only for display purpuses but i am facing error by doing that in select statement. that procedure is working well with bind variable but not with select statement.
    plz help me how i can use a procedure in select statement. or can i do it or not.

    plz help me how i can use a procedure in select statement. or can i do it or not.A workaround could be to create a wrapper function for your procedure. One that only passes the input parameters and returns the output parameter.
    The simply call this function in your select which internally calls the procedure.

  • Can we call a procedure in select statement?

    Can we call a procedure in select statement?

    Hi,
    Raghu_appsdba wrote:
    Can we call a procedure in select statement?No. You can call functions, but not procedures.
    If the procedure does not change the database state (for example, it doesn't update any tables), then you can wrap it in a function, or re-write it as a function.
    Here's an example of wrapping.
    CREATE OR REPLACE FUNCTION fun_x (in_txt IN VARCHAR2)
    RETURN  VARCHAR2
    IS
    BEGIN
            proc_y (in_txt);
            RETURN  in_txt
    END     fun_x;

  • Can't use procedure in the .rdl file.

    Hi experts,
    I created a simple River project, and I can active the project successfully.
    But when i added some codes to call a procedure, then i can't active the rdl file.
    This is the code I used to call a procedure:
    action callExternalProc2() : DecimalFloat[]
          let x  = sap.hana.catalog.RIVERPRJ.MY_PROCEDURE_TEST3();
          return x;
    The error message met when active the project is:
    A transaction rollback may have left the object in an inconsistent state.
    exception 40183:
    repository/base/activation/activator.cpp:884
    Transaction rollback detected. Activation failed.
    When i commented the above codes, the activation will be successful.
    And the procedure can execute in SQL console.
    Can you give me some suggestions?

    Hi Omer,
    I tried to create my stored procedure in another schema(owned by my user), but I still can't active the rdl file.
    Also, I can't execute the following sql statement using my user or the system user:
           set schema "RIVERPRJ";
           grant execute on MY_PROCEDURE_TEST3 to _SYS_REPO with grant option;
    The error message is:
         Could not execute 'grant execute on MY_PROCEDURE_TEST3 to _SYS_REPO with grant option' in 10 ms 659 µs .
         SAP DBTech JDBC: [258] (at 17): insufficient privilege: Not authorized to grant the privilege on the procedure: line 1 col 18 (at pos 17)
    If I active the rdl file, the error message is as follows:
    In the procedure, if I do some queries from the tables created by the rdl, it did not work, but it works if I do some queries from the tables which were not created by the rdl file.
    I think this maybe the reason for the error message "A transaction rollback may have left the object in an inconsistent state." .
    In my opinion, I think we can not use a stored procedure that do some queries from tables created by the rdl entities.
    Because create the entity and call the procedure at the same time may left the object in an inconsistent state.
    Put the queries in an action is ok, but the river can not support some key words like "lag over",.
    So i am trying to put these things in a procedure and call it in the action.
    If  we can't use procedure, how could I use some sql key words like "lag over"?
    Could you give me some suggestions?
    Thanks very much for your help.
    Regards
    Eric

  • Why I can't use javac? and why my program doesn't pop up cmd window?

    I have 2 questions here:
    1) I try to compile my HelloWorld.java using command prompt,
    javac HelloWorld.java
    But it won't work; by right it should create a HelloWorld.class. When I go to Configure/Options/JDK Profile, it is already showing JDK version 1.6.0_07. My environment variables show User variables and System variables with C:\Program Files\Java\jdk1.6.0_07\bin. This is where my JDK is stored, but I don't know why I can't use javac. It keep saying
    'javac' is not recognized as an internal or external command, operable program or batch file
    2) Why is it when I run my java script using JCreator, the print out appear in the box below in JCreator and not in command prompt? How can I make it pop up on command prompt window?

    Things tend to move fasterYep... until something goes wrong... then you're completely stuffed, because you have no idea what's actually happening, because the idjit IDE is hiding all the gory details... it doesn't even tell you what it's doing, let alone how it's doing it, or what to do when it fails.
    Another argument for the command line is that it's simple. There are 16 distinct dialogues involved in adding a new jar to a library in jBuilder... There may well be less than 16 characters in the equivalent edition to the equivalent build command line. That's an extreme case, I admit, but it goes to disprove the notion that IDE's are simpler for noobs.
    Also, it's easier to get help on command line usage... because it's all text based you can just copy & paste the problematic command and it's output, and the eggspurts (tm) can do likewise with a response... and there are limited number of command lines out there... and *nix, windows, and mac cover maybe 99.5% of java users... and the eggspurts are likely to know all three (colectively if not as individuals) fairly well, because they deal with them all day every day.
    My belief is that noob's are better off at the command line until such time as they need (not just want to play with) a visual debugger... at which time its time to download netbeans and eclipse, and see which one suits you better... if you have money to splurge I'd also evaluate intelliJ... But avoid jBuilder, 2008 is total carp! The FREE eclipse is (IMHO) "nicer to use", and it has a LOT less bugs.
    Cheers. Keith.

  • Why i can't use iCloud tabs on my iPhone 4 ?

    Why I can't use iCloud tabs on my iPhone 4 ? I've surfed in internet With my iPod Touch 4g (ios 6) but i can't find the web pages in iCloud tabs of my iPhone 4. Please help me !

    Hey Snowy Nge,
    Thanks for the question. I understand you are experiencing issues with Personal Hotspot on your iPhone 4. The following article may help to resolve your issue:
    iOS: Troubleshooting Personal Hotspot
    http://support.apple.com/kb/TS2756
    Thanks,
    Matt M.

  • In Siri, I can call by my voice, but why I can not use Siri voice call in my country (Laos), just can call only us phone number; my country we use like 3 number for option call, 8 numbers for call friend but Siri cannot use this please help us, thanks

    In Siri, I can call by my voice, but why I can not use Siri voice call in my country (Laos), just can call only us phone number; my country we use like 3 number for option call, 8 numbers for call friend but Siri cannot use this please help us, thanks
    And please help me can type Laos font in it like andrio phone.

    Hi Cozumel,
    Thanks for posting. I'm sorry you're having problems with your bills. I can take a look at this for you. Drop me an email with your account details and a link to this thread for reference. You'll find the address in my profile.
    Cheers
    David
    BTCare Community Mod
    If we have asked you to email us with your details, please make sure you are logged in to the forum, otherwise you will not be able to see our ‘Contact Us’ link within our profiles.
    We are sorry but we are unable to deal with service/account queries via the private message(PM) function so please don't PM your account info, we need to deal with this via our email account :-)

  • Can not use 'AT LINE-SELECTION' with SET PF-STATUS

    Hi experts,
    my code is like below:
    PARAMATERS: .....
    SET PF-STATUS 'st_nam'.
    Perform Load_data . ' For list display
    START-OF-SELECTION.
    AT LINE-SELECTION.
      Perform list_detail.
    AT USER-COMMAND.
      CALL SCREEN '1001'.
    END-OF-SELECTION.
    When I execute the report , the basic was displayed , but when then i double click on the list to call the next screen '1001'. It did not work , but if i omit the SET PF-STATUS m AT LINE-SELECTION worked week , so in this case what has happened i how can i solve this problem,
    Thaks,
    PS: Reward immediately

    Hi,
    Thank you very much for your helpful answers, I have copied the report downto my system and test it , When i used SET PF-STATUS , i can not use AT LINE-SELECTION to capture events ...May be we can not use these 2 statements in parallel,...:D
    Thanks,

  • Why I can't use a photo on the back cover in

    why I can't use a photo on the back cover in

    I'm assuming you're referring to the back cover of a book in iPhoto.  The reason is non of the themes have a photo on the back cover.  Some have a small photo on the back of the dust jacket.  Go to the back cover, click on it and check out the various layouts available.
    In the future include full sentences and specific information about what you're trying to accomplish, what versions of software you're using, etc. so we don't have to guess.
    OT

  • Why i can not use the ink 650 in the 3515 hp eprint,some body out there to help me out please...

    why i can not use the ink 650 in the 3515 hp eprint?somebody out there to help me please??

    Hi @ronjhay ,
    Thank you for taking the time out of your day to ask that question on the HP Forums today!
    I am having a bit of trouble understanding exactly what it is that you are asking, I apologize. Are you trying to use the number 650 ink cartridge in the printer? And it isn't fitting and you are asking why it isn't?
    Please clarify. Look forward to hearing back from you!
    I worked for HP.

  • Why i can't use my creative cloud,i pay the money this month.my order no is

    why i can't use my creative cloud,i pay the money this month.my order no is:
    [personal information removed... Mod - https://forums.adobe.com/docs/DOC-3731]
    [This is an open forum, not Adobe support, please do not post personal information]

    Try Creative Cloud support (all Creative Cloud customer service issues)
    http://helpx.adobe.com/x-productkb/global/service-ccm.html ( http://adobe.ly/19llvMN )

  • Why i can't use my visa card any more?

    why i can't use my visa card any more?

    That's a question only you and your bank can answer.

  • HT5824 Can I use only one (selected) folder from my documents in iCloud?

    Can I use only one (selected) folder from my documents in iCloud for MAC and PC?

    If the folders were created in the Photos app on the iPad, they don't really contain copies of the photos. They contain pointers to those photos that allow them to appear in the albums that you create. Consequently, they cannot be imported to the computer. Those albums are for local organization on the iPad only And cannot be imported.
    You should be able to select the indicidual phots that you want to import, as far as I know. I can do it on a Mac using iPhoto or Image Capture, so I assume that Windows will allow you to pick and choose which photos you want to import.
    Import photos and videos from your iPhone, iPad, or iPod touch to your Mac or Windows PC - Apple Support

Maybe you are looking for

  • How to test Smart Call Home in cisco router?

    Hi , I have done basic configuration n cisco router for Smart call Home.Please help me out on testing SCH if its proper or requres more configuration.Below is the configuration; call-home contact-email-addr [email protected] mail-server 10.0.0.59 pri

  • Cisco ACS 5.4 problem

    Hello Did anyone experience problem with Service Selection Rules in Cisco ACS. When I click this tab ( it only works for me in google Chrome), configuration is normally opened. But when I want to edit one of two default rules (rules that match radius

  • I have an iPad 3 and the left side touchscreen dont works, how can i fix it ?

    my iPad dont works it left side touchscreen, how can i fix it ?

  • How to Map Jinitiator 1.1.8.7

    Hi All, I Have Jinitiator 1.1.7.31 now I want to replace it with 1.1.8.7 How to do can u pls help me out .... I copyed the 1.1.8.7 .exe in jinit folder still it's goes to 1.1.7.31 Can u tell me where I have to make changes Thanx in advance.... null

  • Problem in updating to ios 7.0.3

    Hello I've update to the new version 7.0.3 But I have a problem after I was asked to update the introduction of email, but I do not know the email icloud due to the purchase iphne of a user from one of the shops thanx