Run function from SQL Workshop Command window

hi, cant get it work, maybe someone will help. i need to test the function running, how to launch it in workshop window?
currently im thinking of something alike:
declare a varchar2(62);
begin
  a:=VAL_MERGE_SQL();
end;Simon

hi Geert,
thanks for the tip, but my function uses DDL statements, so it cant be executed in DML statement like select.
problem solved: DDL statement inside function must use global keyword (create global...) then it can be executed like this:
declare
  a varchar2(62);
begin
  a:=VAL_MERGE_SQL;
end;greets,
Simon

Similar Messages

  • Run procedure from SQL Workshop Command window?

    hi, this one is simple.
    how to run a created procedure from APEX SQL Workshop SQL Command window?
    simon

    Simon,
    begin [proc_name]; end;
    -Carsten

  • Blackmagic removed desktop audio functionality from Declink cards on Windows.... now what?

    So, Blackmagic removed desktop audio functionality from Declink cards on Windows.... now what? After Effects is not programmed to talk to Decklink cards directly on the audio part, there is no ASIO, or mercury playback for the audio part, Blackmagic says it was never intended to be used as an audio card, yet up to last version of version 9 provided an audio driver for it, as a result, now any application not written to talk to the Decklink card directly, can't use the card for audio playback. I'm wondering if they think that the people that uses After Effects don't need audio at all....   rewiring all the rooms in  the post productions facilities that had all the audio of all the system going out via the decklink cards it is not an option.
    I'm wondering if Adobe is aware of this and if it have plans to support direct connection to the Decklink cards on the audio side of After Effects. This is a huge problem for all the people that uses AE and Decklink on windows and wants a profesiona quality audio monitoring.  Audition, Premiere, all of those can work now, but not AE. I remember some time ago AE used to support ASIO, but I do not see that option anymore.

    Adobe talks with Blackmagic regularly and we were recently made aware of this change. It is, clearly, not something under our control but we can provide feedback to them about your responses to the change.
    You are correct, After Effects does not play back audio through Mercury Transmit like Premiere Pro does. This was something we considered for After Effects CC 2014 (CC), but at the time we were developing this release there was no urgent need to do so, and this would require significant work to re-wire how After Effects plays back audio. We will continue to talk with Blackmagic and evaluate what the best plan is going forward.
    Please don't hesitate to file feature requests for us about these issues: http://adobe.ly/feature_request

  • Java Stored Procedure via Function Give 0RA 600 from SQL Workshop and App

    Hi,
    Anyone experienced stored procedures or functions failing when called from APEX app or SQL Workshop ( ora 600 ) yet they work fine when called from SQLPlus?
    Sqlplus connected as my apex workspace schema owner:
    select net_services.test_db_connection_via_ldap(
    'APEXPRD1', 'test1', 'test1', null ) as result from dual;
    RESULT
    The database connection attempt was SUCCESSFUL
    From Apex Sql Worshop:
    select net_services.test_db_connection_via_ldap(
    'APEXPRD1', 'test1', 'test1', null ) as result from dual;
    ORA-00600: internal error code, arguments: [16371], [0x434B08150], [0], [], [], [], [], [], [], [], [], []
    NOTE: Same result when run in response to button push on page in application.
    Apex Version: 3.2.1.00.10
    Oracle Version: 11.1.0.7.0
    NOTE: I am using the embedded plsql gateway; was going to try NOT using it to see if it was shared server related (seemed to be from trc files)
    Any ideas?
    Since the code works from sqlplus, I know that it's good: Here some snippets
    -- ========================================================================================
    public class NetServices extends Object {
    public static String doTestDbConnectionViaLdap
    String piDbConnUrl,
    String piUserName,
    String piUserPassword
         String vResult = null;
    try
         Connection conn = null;
         OracleDataSource ods = new OracleDataSource();
         ods.setUser( piUserName );
         ods.setPassword( piUserPassword );
         ods.setURL( piDbConnUrl );
         conn = ods.getConnection();
         conn.close();
         vResult = "The database connection attempt was SUCCESSFUL";
    } catch ( SQLException e )
         int vErrCode = e.getErrorCode();
         String vErrMsg = e.toString();
              if ( vErrCode == 1017 ) {
              vResult = "The database connection attempt FAILED! Incorrect Username or Password";
         } else if ( vErrCode == 17433 ) { // Null Username or Password
              vResult = "The database connection attempt FAILED! You must provide both a Username and a Password";
         } else if ( vErrCode == 17002 ) {
              vResult = "The database connection attempt FAILED! Net Service Name was Not Found";
         } else if ( vErrCode == 17067 ) { // NULL Net Service Name
              vResult = "The database connection attempt FAILED! You must provide a Net Service Name";
         } else {
              vResult = "The database connection attempt FAILED! Error " + vErrCode;
    return vResult;
    } // method: doTestDbConnectionViaLdap
    -- ========================================================================================
    function do_test_db_connection_via_ldap
    pi_db_conn_url IN VARCHAR2,
    pi_user_name IN VARCHAR2,
    pi_user_password IN VARCHAR2
    return VARCHAR2
    is -- PRIVATE to the net_services package
    language java -- NOTE: See cr_java_class_NetServices.sql for actual java implementation
    name 'NetServices.doTestDbConnectionViaLdap
    ( java.lang.String, java.lang.String, java.lang.String ) return java.lang.String ';
    -- ========================================================================================
    function test_db_connection_via_ldap
    pi_net_service_name IN VARCHAR2,
    pi_user_name IN VARCHAR2,
    pi_user_password IN VARCHAR2,
    pi_search_base IN VARCHAR2
    return VARCHAR2
    is -- PUBLIC procedure
    v_url      VARCHAR2(256);
    begin
    g_err_source := 'NET_SERVICES.test_db_connection_via_ldap';
    g_err_action := 'build_jdbc_conn_url_using_oid';
    /*     NOTE: We don't want to assert the parameters because we don't want to raise
    an exception;
    -- Get the jdbc connection url that uses oid info
    v_url := build_jdbc_conn_url_using_oid( pi_net_service_name, pi_search_base );
    return( do_test_db_connection_via_ldap( v_url, pi_user_name, pi_user_password ) );
    end test_db_connection_via_ldap;
    -- ========================================================================================
    Thanks in advance for your consideration.
    Troy

    Troy:
    You could be right in your guess that the error is related to MTS. Search Metalink for '16371'. Why not switch your APEX app to use OHS and test whether the error persists. ?
    varad

  • Can call a function from SQL COMMAND but can't from the SHUTTLE help please

    I've read this article
    ARTICLE
    I've written the code in a function called SURVEY_USERS that takes one variable
    when I run the following in the SQL builder:
    SELECT SURVEY_USERS('canns') from DUAL;I get
    SELECT smteam.division_manager DS, smteam.division_manager RV from SMTEAM where smteam.division_manager=canns and rownum = 1
    UNION
    SELECT SMTEAM.dept_manager DS, smteam.dept_manager RV from SMTEAM LEFT where smteam.division_manager=canns
    UNION
    SELECT smteam.wdmanagername DS, smteam.wdmanagername RV from SMTEAM where smteam.division_manager=cannswhich is what I want but when I put in into the "list of values definition".
    RETURN SCREPORTS.SURVEY_USERS('canns');I get
    Error     ORA-06550: line 1, column 188: PL/SQL: ORA-00904: "CANNS": invalid identifier ORA-00904: "CANNS": invalid identifier ORA-06550: line 1, column 7: PL/SQL: SQL Statement ignored ORA-00904: "CANNS": invalid identifierI'm just confused as to what I'm doing wrong. I'm passing the same thing to the function...and it appears to be working in the SQL workshop and not the actual LOV Shuttle.
    Edited by: bostonmacosx on Sep 12, 2012 3:45 PM

    Here is some of the function
    create or replace function "SURVEY_USERS"
    (app_user in VARCHAR2)
    return VARCHAR2
    is
      vp_exists INTEGER;
      ed_exists INTEGER;
      dr_exists INTEGER;
      mngr_exists INTEGER;
    begin
    SELECT COUNT(*) into vp_exists
      FROM smteam
      WHERE area_manager= app_user
      AND ROWNUM = 1;
      SELECT COUNT(*) INTO ed_exists
      FROM smteam
      WHERE division_manager = app_user
      AND ROWNUM = 1;
      SELECT COUNT(*) INTO dr_exists
      FROM smteam
      WHERE dept_manager = app_user
      AND ROWNUM = 1;
      SELECT COUNT(*) INTO mngr_exists
      FROM smteam
      WHERE wdmanagername = app_user
      AND ROWNUM = 1;
    --dbms_output.put_line (vp_exists);
    --dbms_output.put_line (ed_exists);
    --dbms_output.put_line (dr_exists);
    --dbms_output.put_line (mngr_exists);
    IF (vp_exists = 1) THEN
      RETURN 'SELECT smteam.area_manager DS,smteam.area_manager RV from SMTEAM where smteam.area_manager='''||app_user||''' and ROWNUM = 1
       UNION
       SELECT smteam.division_manager DS, smteam.division_manager RV from SMTEAM where smteam.area_manager='''||app_user||'''
       UNION
         SELECT smteam.dept_manager DS, smteam.dept_manager RV from SMTEAM  where smteam.area_manager='''||app_user||'''
       UNION
        SELECT smteam.wdmanagername DS, smteam.wdmanagername RV from SMTEAM  where smteam.area_manager='''||app_user||'''';
    END IF;
    IF (ed_exists = 1 and vp_exists=0) THEN
        RETURN 'SELECT smteam.division_manager DS, smteam.division_manager RV from SMTEAM  where smteam.division_manager='''||app_user||''' and rownum = 1
       UNION
         SELECT SMTEAM.dept_manager DS, smteam.dept_manager RV from SMTEAM LEFT where smteam.division_manager='''||app_user||'''
       UNION
        SELECT smteam.wdmanagername DS, smteam.wdmanagername RV from SMTEAM where smteam.division_manager='''||app_user||'''';
      END IF;
    IF (dr_exists = 1 and ed_exists=0 and vp_exists=0) THEN
         RETURN 'SELECT smteam.dept_manager DS, smteam.dept_manager RV from SMTEAM  where smteam.dept_manager=:'''||app_user||'''and rownum = 1
       UNION
        SELECT smteam.wdmanagername DS, smteam.wdmanagername RV from SMTEAM  where smteam.dept_manager='''||app_user||'''';
      END IF;
    IF (mngr_exists = 1 and ed_exists=0 and vp_exists=0 and dr_exists=0) THEN
        RETURN  'SELECT smteam.wdmanagername DS, smteam.wdmanagername RV from SMTEAM  where smteam.wdmanagername=:'''||app_user||''' and rownum = 1';
      END IF;
    END;
    Edited by: bostonmacosx on Sep 12, 2012 3:56 PM

  • Calling a R function from sql

    Hello there, can anyone help me on the following query ?
    1) I have a data view called Q_X1_V stored in a database schema, which has a column called OBS03
    2) I have logged in to the schema where the above mentioned view is defined using sqldeveloper
    3) I have created the following R function and executed in sql developer
    begin
       sys.rqScriptDrop('xbarr-qcc');
       sys.rqScriptCreate('xbarr-qcc', 'function() {
       library(ORE)
       ore.sync(table=Q_X1_V)
      ore.attach()
    dataset <- ore.pull(Q_X1_V["OBS03"])
    head(dataset)
    end;
    It has created the function successfully.
    4)  and I am trying to execute the following sql query in sql developer
    select *
    from table(rqEval(NULL,'select 1 "OBS03" from dual','xbarr-qcc'));
    and it results in the following error
    ORA-20000: RQuery error
    Error in .ore.schema(schema) : attempt to apply non-function
    ORA-06512: at "RQSYS.RQEVALIMPL", line 104
    ORA-06512: at "RQSYS.RQEVALIMPL", line 101
    20000. 00000 -  "%s"
    *Cause:    The stored procedure 'raise_application_error'
               was called which causes this error to be generated.
    *Action:   Correct the problem as described in the error message or contact
               the application administrator or DBA for more information.
    Not sure how to trouble shoot the issue
    5) Above R function mentioned in the step:3 works fine on the R command prompt
    and gives me the following output
    OBS03
    1 10.872
    2 10.818
    3 10.802
    4 10.622
    5 10.708
    6 10.658
    and how do I make the sql command mentioned in step:4 work in sqldeveloper command line.
    Any help is appreciated.
    thanks
    Pradeep

    Sherry,  thanks for the reply.
    1) I have logged into the database user via sqldeveloper as "ruser"
        and executed the following script for creating the R function
    begin
       sys.rqScriptDrop('xbarr-qcc');
       sys.rqScriptCreate('xbarr-qcc', 'function() {
       library(ORE)
    # ore.connect(user="ruser" ....   )  -- commented this out as I have already logged into the "ruser" schema of database
       ore.sync(table="Q_X1_V")    
       dataset <- ore.pull(Q_X1_V["OBS03"])  # pulling the data from the column OBS03 of the table. Q_X1_V
       dataset           #  simply return the rows
    end;
    2)  Now when I execute the following sql select command
    select *
      from table( rqEval(
            cursor(select 1 "ore.connect" from dual),      ## -- was hoping this will help me connect with the db schema.
            'select 1 "OBS03" from dual',
            'xbarr-qcc'));
    but I end up getting this error :
    ORA-20000: RQuery error
    Error in ore.pull(Q_X1_V["OBS03"]) :
      error in evaluating the argument 'x' in selecting a method for function 'ore.pull': Error: object 'Q_X1_V' not found
    ORA-06512: at "RQSYS.RQEVALIMPL", line 104
    ORA-06512: at "RQSYS.RQEVALIMPL", line 101
    20000. 00000 -  "%s"
    *Cause:    The stored procedure 'raise_application_error'
               was called which causes this error to be generated.
    *Action:   Correct the problem as described in the error message or contact
               the application administrator or DBA for more information.
    So what am I missing,
    1) I don't want to use ore.connect inside my R script because that will lead to security standards violations as the login credentials will be visible to all
    2) Once connected to the ruser, I should be able to run R script seemlessly with out passing in login credentials explicitly.
    which I thought  the sql script in step 2, with ore.connect in params should be helpful.   but for some reason it is erroring out.
    Could you pl. help.
    thanks

  • CR2008 - How to run a Stored Procedure using Command Window

    Hi everybody,
    To generate my reports, I always adopted the foll. strategy:
      (a) Create a SQL Stored Procedure (with Input parameters) in Management Studio
      (b) Design a report in Crystal Report using the SP as datasource
    I want to experiment something different.
    Instead of using the SP as datasource, I wish to use the SQL Command window in CR2008.
    I have never succeeded to make it work.
    So, I am giving a simple example below , listing all my steps, so you can spot where my problem is:
    (A) Create a simple Stored Procedure in SSMS called [dbo].[usp_2014]
    USE [SIMUL02]
    GO
    /****** Object:  StoredProcedure [dbo].[usp_2014]    Script Date: 07/21/2014 12:40:22 ******/
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    ALTER PROCEDURE [dbo].[usp_2014] @Project nvarchar(15)
    AS
    SELECT DocEntry, DocDate, U_ShipDept, DocTotalSy FROM ORDR
    WHERE U_ShipCode = @Project
    (B) Create a Crystal Report called TEST.rpt
          I typed the following in the Command Window (see Capture.jpg)
              {CALL "SIMUL02"."dbo"."usp_2014";1({?Project1})}
    (C) I verify the database. I get this error message:
          Failed to retrieve data from the database
            Invalid character value for cast specification
    I am blocked from here.
    Please let me know what has gone and what I must do to continue my tests.
    Thanks
    Leon Lai

    Hi Abhilash
    I copied and pasted your formula:
    Exec "SIMUL02"."dbo"."usp_2014" '{?Project}'
    Now it works!
    So, probably I typed something wrong, and did not notice
    Thanks a lot for your patience and great reply
    Closing
    Leon Lai

  • Calling function from sql folder vs report

    Hi,
    A report based on a custom sql folder is taking a long time to run. One of the things that I noticed is that when I run the sql in plsql it takes a long time, but if I remove the row where I call a function, it runs pretty quickly.
    In general, is there a difference between running a function from the sql custom folder and calling it from the report itself?
    Thanks.
    Leah

    Hi Tamir,
    I might check out the execution plans, but truthfully, understanding the plans and the meaning of the differences is not my strong point.
    I thought that maybe there was some general rule that, for instance, it is better to keep functions out of the sql folder and use them in a condition in the report itself, or the opposite, or that maybe it makes no difference at all.
    I appreciate the response.
    Thanks.
    Leah

  • Calling the function from SQL query

    Hi,
    I am trying to run the below statement,
    Select to_number(apps.pay_balance_pkg.get_value( 326, :paa.assignment_action_id,to_date ('31032011','ddmmyyyy'))) from dual;
    getting an error as :
    ORA-14552 cannot perform a DDL, commit or rollback inside a query or DML
    ORA - 06512 at apps.pay_balance_pkg , line 4526.
    How can I execute this funciton "apps.pay_balance_pkg.get_value" from sql query?
    Thanks in advance.

    user1175432 wrote:
    Hi,
    I am trying to run the below statement,
    Select to_number(apps.pay_balance_pkg.get_value( 326, :paa.assignment_action_id,to_date ('31032011','ddmmyyyy'))) from dual;
    getting an error as :
    ORA-14552 cannot perform a DDL, commit or rollback inside a query or DML
    ORA - 06512 at apps.pay_balance_pkg , line 4526.
    How can I execute this funciton "apps.pay_balance_pkg.get_value" from sql query?
    Thanks in advance.If the function is performing DDL, commit or rollback inside it then you will not be able to call it from an SQL statement.
    Either change the function so it doesn't perform DDL, commit or rollback, or use a different means to obtain the information you want (assuming you can't change the function)

  • Call external function from SQL query

    Hi,
    I am new to PL/SQL programming.I don't think this is possible but please let me know if there is a way to achieve this. I have a function written in VB.net and I would want to call from the query.
    create table temp as select id, callvbfunction(note_text) from temp2
    Here callvbfunction is the vb.net function.I need to pass note_text field value to the function.
    Thanks..

    Yes it is possible.
    No idea how to specifically call a .Net function (from Oracle) as I do not do Windows (except for playing games ;-) ). But external procedures (extproc) and Java stored procs can be wrapped by PL/SQL wrapper functions and used in SQL statements.

  • Unable to run reports from the unix command line

    hi
    all of a sudden i am unable to run reports ( on App server 10g) either from the unix scripts or from the unix command line. But i can run them from the forms.
    Any one have any idead about this.
    Thank you

    thanks all for replying
    i have set the env variables for the session and it worked. Looks like i have to set the oracle_home and ld_library_path every time ( opening a new putty session) i call sqlldr.
    But in a whole i am trying to run sql loader from the forms. Right now we have Oracle app server 10g which forms 10g version. As oracle app server 10g didnt come with sqlldr, we are copied the sqlldr of database on to app server with different home. after this we can run sqlldr ( on app server ) from unix scripts but not from Forms. Then we opened a qurey with oracle about app server 10g not commig with sqlldr and its remedy . But they said that they dont have specific remedy for that and suggested the same what we did.
    So we came up with java package which does the same funtion as host command and trying to run sqlldr which is on the database( ie replacing the host command in the forms with the database funtion). By using that funtion i am able to run the sqlldr from sql plus but not from forms. I couldnt easily debug it as i wont through any error messages.
    Any one have any idea of this ...
    Thank you

  • SQL works from SQL*Plus command line but not as a DBMS_JOB submitted job

    Oracle 10g 10.2
    Got a procedure which does not run correctly as an Oracle job but runs fine as a SQL script.
    There are no Oracle errors (or any errors) of any kind when the job does not run fine – it just does not update any rows. But when run as a SQL script – the same way it is run as a job – then the rows are updated.
    Any ideas?

    Good stuff....
    See my replies to some of the questions in italics
    a) Different NLS settings => The job uses the NLS settings of the session that created it. If you create it with some tool like TOAD, you might have a different environment than with sql*plus. Runs good in TOAD and SQL*Plus using the command-line feature - just 'acts funky' when submitted.
    b) Interval issue. Are you sure the job was running? Isn't still running? The job runs successfully - even logs a successful message in our logging table.
    c) User/priviledge issue. Sometimes a job needs direct grants whereus a procedure can be called with priviledges granted through roles. Don't know - need to check this out.
    d) Transaction handling / Error Handling. The job runs into some error, but the error is supressed, because of bad exception handling. What is the value in the BROKEN column, when you do: select * from user_jobs; I would think that, since the errors are logged into a side table, an error would be found there. However, no errors are found. The BROKEN column is 'N'.

  • Getting zero-sized reply error when running report from SQL query

    Hi,
    I have a Report from SQL Query in Portal. When I select Excel in Output Format and then run the report, it works properly, but when I select HTML in Output Format, the report works if the rows returned are not so many (I've been able to display the report for up to 701 rows), but when I try selecting a value from the LOV that selects many rows, I get the following error:
    ERROR
    The requested URL could not be retrieved
    While trying to retrieve the URL: <data suppressed>
    The following error was encountered:
    Zero Sized Reply
    Squid did not receive any data for this request.
    Any ideas on how to fix this? Why does the number of rows returned affect the report this way?
    Thanks,
    Lorena

    Problem comes when any of the filter is applied in any one of the cases selected from the GUI.Do you mean that the problems only shows when you run the report in your browser via 9iAS?
    Which version are you using?
    Can you post the before report trigger?

  • How to pass table type variable into function from SQL*PLUS ?

    How to pass a table type variable from sql*plus prompt into a function ?
    Thanx in advance.

    Krishna,
    Do you mean like this?SQL> DECLARE
      2      TYPE t_tbl IS TABLE OF VARCHAR2(20);
      3      l_sample_tbl           t_tbl;
      4
      5      FUNCTION print_contents ( p_tbl IN t_tbl )
      6      RETURN VARCHAR2
      7      IS
      8          l_string            VARCHAR2(1000);
      9      BEGIN
    10          FOR i IN 1..p_tbl.COUNT LOOP
    11              IF (i = 1) THEN
    12                  l_string := p_tbl(i);
    13              ELSE
    14                  l_string := l_string || ', ' || p_tbl(i);
    15              END IF;
    16          END LOOP;
    17          RETURN (l_string);
    18      END print_contents;
    19
    20  BEGIN
    21      l_sample_tbl := t_tbl();
    22      l_sample_tbl.EXTEND;
    23      l_sample_tbl(1) := 'one';
    24      l_sample_tbl.EXTEND;
    25      l_sample_tbl(2) := 'two';
    26      l_sample_tbl.EXTEND;
    27      l_sample_tbl(3) := 'three';
    28      l_sample_tbl.EXTEND;
    29      l_sample_tbl(4) := 'four';
    30      l_sample_tbl.EXTEND;
    31      l_sample_tbl(5) := 'five';
    32      DBMS_OUTPUT.PUT_LINE(print_contents(l_sample_tbl));
    33  END;
    34  /
    one, two, three, four, five
    PL/SQL procedure successfully completed.
    SQL> HTH,
    T.

  • Download function in SQL Workshop - Object Browser

    I am an APEX newbie, trying to download the data from a view into a .csv file. I am doing this in SQL Workshop, in the Object Browser - I click the 'download' link at the bottom of the page and it allows me to dump the data to a .csv file - no problem. My issue is this: it is only downloading the first 500 rows. How can I tell it to download all rows?
    Thanks in advance for your help...
    Kenny

    Try this...
    In object browser,
    1. Click Data (next to Table link on top).
    2. Then click on Query.
    a. If you are selecting all rows, check on the Check All checkbox. If not select the appropriate columns.
    b. Then click Query
    3. Now you will see the Display option on the top.
    4. Select number of rows from drop down.
    5. Click Go
    6. Now download.
    Hope this helps!
    Thanks!

Maybe you are looking for