User/privleges runs a stored procedure

I'm not sure I understand how stored procedures work and had a few questions that I couldn't find the answer too. I have Google had for her and watched on forms SQL/PL/SQL here and don't see anything that has answered the questions.

Here's my situation:

I connected the diagram of the system as the system user. Under (SQL Developer) I have other users: user1 and user2.

I wrote a stored procedure that compiles without error/warning under area of stored procedures of user2. It uses the data in the tables of the User1.

In this procedure, I want to create a view, a treatment and then delete the stored procedure. When I run the procedure by right-clicking on the procedure and choosing run, the statements of views create do not create views.

I would have thought that I ran it as a 'system', which should allow me to create views in the area of views of user2. It seems that this is not the case. I don't understand why. Any ideas? If you can point me to a place where has been answered a question like this, or the documentation, I'll take the link.

Thank you

VIC

[Invoker rights vs rights define | http://download-uk.oracle.com/docs/cd/B10501_01/appdev.920/a96624/08_subs.htm#18575]

Tags: Database

Similar Questions

  • setting report parameters fails for the report that runs the stored procedure in QMR FDM 2.1.1

    Hello

    Can someone help us please on this issue we have; If a solution is already available somewhere on the forum please link me to it.

    Please see our situation;

    The script below was part of the customization of a colleague to a script of Oracle FDM ("AftFileImport").

    There are no screenshots at this stage that came back to us with a temporary workaround.

    More detailed description:

    We built a custom report of FDM ("FSBValidationErrorsforAllLocations") that accepts two parameters (CatKey, period) and which calls a procedure stored in SQL Server with the same two parameters. FDM SQL statement of the report is:

    RUN FSBValidationErrorsforAllLocations ' ~ time ~', ~ Cat Key ~

    It works through the User Interface.

    When you try to put the two settings by customizing the event Oracle 'AftFileImport'script, the report fails. Below the part of the code in the 'AftFileImport', where we tried to fill values:

    • objReport.mParametersClear
    • objReport.mParametersAddNew "CatKey", RES. PstrCat
    • objReport.mParametersAddNew 'Period', RES. PstrPer

    We must understand why the way above to the definition of the parameters does not work with stored procedures, as seems to be the only documented way Oracle of setting parameters.

    Please let me know if that's enough.


    Thank you in advance.

    Hello

    which is the error when you run the script?

    • objReport.mParametersAddNew "Cat Key", RES. PstrCat

    Try again with the white space as it is how you named your parameter in the report definition, didn t you?

    Also try to use the built like the following examples:

    objRP.mParametersClear
    objRP.mParametersAddNew 'Period', CDate (dtePeriod)
    objRP.mParametersAddNew 'Loc', CLng (lngLocation)
    objRP.mParametersAddNew 'CatKey", CLng (lngCatKey)
    objRP.mParametersAddNew "TargAcct", CStr (strAutoMapAcct)

    Concerning

  • Need help, run the stored procedure in ASP.

    I have a web page in which I would use a query like http://ereply.us/q/l.asp?id=383966476 string

    It directs the user to a page that contains the following code:

    <!-queue = "database_connection.asp #include" - > "
    < %
    If not isempty (request.querystring ("id")) then
    SQL = "exec dbo.fp_qr_code @sequence (request.querystring ("id")) =" "

    If rs.state = 1 then rs.close
    RS. Open sql, conn, 3, 2

    If rs.recordcount <>0 then
    session("Name") = rs ("name")
    session("JobID") = rs ("jobid")
    session("SEQ") = rs ("seq")

    If rs ("id") <>"" then the answer. " Redirect ("index.asp")
    end if
    end if
    % >

    It queries a SQL database to return the value of 'name '. In turn, according to the code of the user should be directed to 'Index.asp' that contains:

    Welcome < % response.write (session("name")) % >

    And the page you should see the page with"Welcome".  Instead, I get a server 500 error.  The stored procedure runs as a stand-alone query in SQL Management Studio.

    Any ideas would be greatly appreciated.

    I solved this.  This is the query that worked:

    < %="">< br="">SQL = "" exec fp_qr_code ' "& request.querystring ("id") &" ' " < br=""> set rs = Conn.Execute (sql) < br=""> if rs.eof then response.write ("no registration") < br=""> while not rs.eof" ""
    response.write (("name") rs)

    response.write (("imgname") rs)

    response.write (rs ('url'))

    RS.MoveNext
    Wend < br=""> %>

  • How to run a stored procedure by using the steps in database?

    Hello

    I'm trying to run some procedures of the store and it will not work.

    See the file attached is seq.

    I have a varchar parameter (50), which must also be provided to the stored procedure and it returns an int.

    To do this I had to only use data in an open statement

  • Access to the defined user compex types in stored procedure

    Hi all

    I have two complex types defined by the user which are defined as follows:

    create or replace

    TYPE 'MA_ROOT_OBJECT' AS THE OBJECT

    (

    USER_MACHINE VARCHAR2 (30),

    USER_DOMAIN VARCHAR2 (60),

    DATE OF EVENT_ACTIVITY_DT,

    USERCOLL MA_USER_TABLE,

    DATABASECOLL MA_DATABASE_TABLE

    )

    And USERCOLL and DATABASECOLL are again a different complex types defined by user 2. What should I do for the DATABASECOLL of the stored procedure?

    I am getting error below when I try to access:

    • Error (13.31): PLS-00302: component 'TMP_DATABASECOLL' must be declared

    ######################################################

    PROCEDURE SP_MSACCESS_METADATA)

    MSACCESSCOLL IN MA_ROOT_TABLE,

    STATUS OF THE VARCHAR2)

    AS

    TMP_DB_NAME VARCHAR2 (100);

    TMP_DATABASECOLL MA_DATABASE_TABLE;

    meter NUMBER (3);

    BEGIN

    SAVEPOINT INIT;

    TMP_DB_NAME: = MSACCESSCOLL. TMP_DATABASECOLL. DB_NAME

    EXCEPTION

    WHILE OTHERS THEN

    STATUS: = "ERROR BY STORING DEMAND MSACCESS."

    RAISE_APPLICATION_ERROR (-20001, SQLERRM);

    ROLLBACK TO SAVEPOINT INIT;

    END SP_MSACCESS_METADATA;

    Since MA_DATABASE_TABLE is a collection, you must tell Oracle item on which you want to:

    For example, if you want only one element in the collection:

    TMP_DB_NAME: = MSACCESSCOLL. DATABASECOLL (1). DB_NAME;

    otherwise, you will need to loop.

  • How can I automatically run a stored procedure when a report is called?

    I've created a classic report on a table (without screen). When I go to this report, I would like to the stored procedure that deletes and inserts information about the table that is based on the report has been started automatically. Where and how can I do to put the call to the stored procedure that the report displays the data once the report is called?

    Thank you!

    Mark1970 wrote:

    I've created a classic report on a table (without screen). When I go to this report, I would like to the stored procedure that deletes and inserts information about the table that is based on the report has been started automatically. Where and how can I do to put the call to the stored procedure that the report displays the data once the report is called?

    Create a page of PL/SQL process by calling the procedure with a Point process On Load - front of regions.

    The report is based on a global temporary table?

  • Run the stored procedure of c#

    Hi, im new to the use of stored procedures and I have the following stored procedure...

    CREATE OR REPLACE PROCEDURE DRL_PROCEDURE2 (var_SOURCE_OBJECTID IN varchar2, var_NEW_OBJECTID OUT varchar2)
    AS
    BEGIN
    SELECT MAX (NEW_OBJECTID)
    IN var_NEW_OBJECTID
    OF DRL_CONVERSION
    WHERE SOURCE_OBJECTID = var_SOURCE_OBJECTID;
    END;

    I want to be able to call this procedure from my windows form application and display the result of the stored procedure in a label... could someone please help me! Thanks in advance!

    http://www.csharpfriends.com/articles/getarticle.aspx?articleid=78
    You can find out how to call the stored procedure (in the link above you will find an example of SQL Server 2005 that also work for you from your oracle stored procedure) in c#.

    HTH
    Girish Sharma

  • How to run a stored procedure in TOAD 9.0

    Dear friends,

    I use TOAD 9.0.

    Running a procedure, but the error...


    create or replace PROCEDURE UPD_TBL (parameter i_nom_table IN VARCHAR2) IS
    CURSOR c_columns is select column_name from ALL_TAB_COLUMNS where
    Table_name = i_nom_table parameter;
    BEGIN
    FOR rec in c_columns
    LOOP
    IF (CRE. COLUMN_NAME = "X_NNM_TYPE_CD") THEN
    UPDATE parameter i_nom_table value X_NNM_TYPE_CD = REPLACE (X_NNM_TYPE_CD, '-', '_')
    WHERE INSTR (X_NNM_TYPE_CD, '-') > 0;
    ELSIF (CRE. COLUMN_NAME = "X_REVENUE_TYPE_CD") THEN
    UPDATE parameter i_nom_table value X_REVENUE_TYPE_CD = REPLACE (X_REVENUE_TYPE_CD, '-', '_')
    WHERE INSTR (X_REVENUE_TYPE_CD, '-') > 0;
    END IF;
    END LOOP;
    EXCEPTION
    While OTHERS then
    NULL;
    END UPD_TBL;

    ERROR: TABLE OR VIEW DOES NOT EXIST.

    Please let me know how to perform the procedure in Toad.

    Thank you/kumar

    kumar73 wrote:
    I use kaw_owner schema for the tables.

    I'm not sure I understand what you're saying here. Do you mean that the tables are the property of KAW_OWNER? That the procedure is owned by KAW_OWNER? You added an OWNER = predicate "KAW_OWNER" to the query? Or something else?

    I'm passing valid table name but always the for loop is not an iteration.

    I had the habit now of user_tab_columns but no record recovery.

    There are still two possibilities. The table name is incorrect or the owner of the procedure has sufficient privileges. I don't know which account is the owner of the procedure or how you gave that account access to the tables, so it is difficult to be more specific that declare that the owner of the procedure needs direct access to the tables so that the query return lines.

    As the owner of the procedure, connect to SQL * Plus, type

    SET ROLE OFF;
    

    Run the query with the name of the hard-coded array and display the results

    Justin

  • How to run a stored procedure in an interval of time repeatedly

    Hello

    can someone please tell me, I have a procedure and I want that procedure must be run in each 1o minutes apart.








    Thank you
    Madam.

    It would be preferable to use DBMS_SCHEDULER. There a ways more intuitive and flexible syntax to specify calendar intervals:

    repeat_interval => 'FREQ=MINUTELY;INTERVAL=10'
    
  • Dbms_metadata in a stored procedure. If the table is in the schema, run the stored procedure the procedure works very well.  If I try to get the table ddl to a different scheme it can't find table in a schema.  I run as an anonymous blocks and it works

    create or replace FUNCTION get_table_md (p_owner in varchar2, p_table IN VARCHAR2) RETURN CLOB IS
    -Define local variables.
    / * declare
    p_owner varchar2 (30): = "AVTYM";
    p_table IN VARCHAR2 (30): = "TRANSACTION_HEADER";
    */
    h NUMBER; -handle returned by OPEN
    e NUMBER; -handle returned by ADD_TRANSFORM
    p_tableref varchar2 (30);
    doc CLOB.
    Doc2 CLOB.
    BEGIN

    -Specify the type of object.
    h: = DBMS_METADATA. OPEN ('TABLE');

    -Use filters to specify the desired object.
    DBMS_METADATA. SET_FILTER (h, 'SCHEMA', p_owner);
    DBMS_METADATA. SET_FILTER (h, 'NAME', p_table);

    -Request that the metadata be transformed into creation DDL.
    th: = DBMS_METADATA. ADD_TRANSFORM (h, 'DDL');

    -Retrieves the object.
    doc: = DBMS_METADATA. FETCH_CLOB (h);


    -Free resources.
    DBMS_METADATA. Close (h);
    p_tableref: = substr (p_table, 1, 25). ' $RDEF';
    Doc2: is REGEXP_replace(doc,p_table,p_tableref,1,1,'im');.
    doc: = REGEXP_replace(doc2,'"CREATE_DT"','"EXCHANGE_DT"',1,2,'im');
    -dbMS_OUTPUT. Put_line (doc);
    RETURN doc;

    END;

    Hello

    check the privilege you may have granted by a role that you need direct access to the object and not by the role. You can test if you are granted by a role, by running the SET command role no and see if you can still run the anonymous block.

    Thank you

  • How to view the run log in the stored procedure?

    Hello

    I'm working on a project of migrating from Sybase to Oracle (10g).

    On Sybase, when I run a stored procedure, it will connect to the console as:
    100 rows inserted
    200 rows affected
    ...

    One line per request in the stored procedure.


    Oracle, I only: 'Procedure completed successfully' (Yes, I'm french :-)


    Is there a way to get the logs for each request in my stored procedure?
    -An option?
    -One command after each request?


    Thanks in advance.

    user9321154 wrote:
    OK, it's great.

    Otherwise, there is not an option on Oracle to achieve this same result automatically.

    No, if you want to do this, you must do it yourself. PL/SQL is a real language, not a script like T - SQL language. Therefore, it is the procedure that one is successful or not, not every instruction.

    You should also be aware that if you use % ROWCOUNT SQL to get the number of rows processed and DBMS_OUTPUT. Put_line to show them on the screen, that the output will not appear before once you have completed the process, not as each DBMS_OUTPUT statement is processed.

    If you want to t shelves where in the procedure, you will need to insert the release of record in a table by using an autonomous transaction or something like UTL_FILE use to write the instructions in an o/s file.

    John

  • Run the statement in a stored procedure with Out parameters and

    Hi all

    I have a stored procedure that calls a select statement. Here it is...

    CREATE OR REPLACE PROCEDURE BLABLA_VIEW_PROCEDURE

    * (BLABLA_KEY IN NUMBER, *)
    XML_OUTPUT ON VARCHAR)
    AS
    BEGIN
    SELECT SYS. XMLTYPE.getStringVal (OBJECT_VALUE) in XML_OUTPUT FROM BLABLA_VIEW WHERE extractValue (OBJECT_VALUE, ' / BLABLA_TYPE/BLABLA_KEY ') = 2876;
    END;

    Is to have both IN and OUT parameters as described above. I am able to compile and run the procedure.

    The problem I want to share with everyone is...
    I want to run the stored procedure together with a single EXEC command.

    I tried different ways using the EXEC command but of no use.

    Could someone help me?
    Thanks in advance.

    Published by: user10763276 on June 3, 2010 15:47

    Please visit the following...

    sudhakar@ORCL>CREATE OR REPLACE PROCEDURE BLABLA_VIEW_PROCEDURE
      2  (BLABLA_KEY IN NUMBER,
      3  XML_OUTPUT OUT VARCHAR)
      4  AS
      5  BEGIN
      6  XML_OUTPUT := BLABLA_KEY || ' and whatever else...';
      7  END;
      8  /
    
    Procedure created.
    
    sudhakar@ORCL>
    sudhakar@ORCL>var XML_OUTPPUT varchar2(100);
    sudhakar@ORCL>exec BLABLA_VIEW_PROCEDURE (9151, :XML_OUTPPUT);
    
    PL/SQL procedure successfully completed.
    
    sudhakar@ORCL>print XML_OUTPPUT;
    
    XML_OUTPPUT
    --------------------------------------------------------------------------------
    9151 and whatever else...
    
    sudhakar@ORCL>
    

    Post tells you...

    var OUTPUT VARCHAR
    exec BLABLA_VIEW_PROCEDURE (9151, :OUTPUT);
    print OUTPUT
    

    VARCHAR is not a valid TYPe to declare. Use VARCHAR2 (nnn) where nnn is a number.
    VR,
    Sudhakar B.

  • SQL stored procedure input and output parameters

    Hello Gang,

    My dead end trying to call a stored procedure in SQL Server 2008 with the LV database tool.

    for purposes of experimentation, I've created a small procedure with an input parameter that returns an integer as return value.  It works describing a query, but all attempts at LV produce an error-2147217900 when executing query VI.  I did find examples of that.

    Sending a bunch of parameters to a stored procedure and checking the value of return seems to be pretty common stuff.

    I'll appreciate any help.

    Thank you

    Roger

    Hi Roger,

    There are a few prerequisites which I will list below. If you have not checked these things, so don't hesitate, as your hiccups can be there.

    Prerequisites:

    1. Ensure that you can read from a table in the database to verify that you can access the database (user permissions) and ensure that your login details are correct. Among other things, make sure that the. DSN switches to the correct database. (See the simple example below, SQL Select.vi)
    2. Make sure that your user (if you use SQL authentication) has permissions to run the STORED procedure by running the procedure in SQL Server Management Studio (you seem to have already done this)

    Example by calling a procedure without parameters (attached as SPROC_No_Parameters.vi):

    Example by calling a procedure with parameters (attached as SPROC_Parameters.vi):

    An article on the execution of stored procedures is here:

    http://digital.NI.com/public.nsf/allkb/07FD130746083E0686257300006326C4

    Don't forget to download the example VI since it includes the cases where you want an output parameter of the procedure rather than a table.

    I tested these against two very simple SPROCs and it worked fine (on SQL Server 2005, but 2008 should be the same).  Stored procedures have been:

    CREATE PROCEDURE [dbo]. [GetContacts]

    AS
    BEGIN
    -SET NOCOUNT ON added to avoid additional results sets from
    -interfering with SELECT statements.
    SET NOCOUNT ON;

    -Controls insert for procedure here
    SELECT * FROM Contacts
    END

    and

    CREATE PROCEDURE [dbo]. [MultiplyAges]
    @param1 INT = 1
    AS
    BEGIN
    -SET NOCOUNT ON added to avoid additional results sets from
    -interfering with SELECT statements.
    SET NOCOUNT ON;

    -Controls insert for procedure here
    SELECT (age * @param1) OF Contacts
    END

    I would like to know if these examples work for you or if you have any other questions.  Don't forget to go through this KB article and articles related to it, they should cover other situations.

    Matt

  • After upgrading vCenter 5.0 to 5.1 found stored procedure 'purge_stat1_proc '.

    Hi all.

    After upgrading vCenter 5.0 to 5.1 found this error in MS SQL 2008 R2 during the performance of work ""past day stats rollup ": "

    Message
    Executed as user: xx\yyyy. Stored procedure 'purge_stat1_proc' not found. [SQLSTATE 42000] (Error 2812).  The step failed.
    and http://kb.vmware.com/selfservice/microsites/search.do?cmd=displayKC & docType = kc & docTypeID = DT_KB_1_1 & externalId = 2006097 there is no stored procedure in vCenter 5.1 purge_stat1_proc installation but job day cumulative stats exist...
    Also there is not a SQL script for this procedure in the vCenter Server installation folder in C:\Program Files\VMware\Infrastructure\VirtualCenter Server\sql.
    Anyone have a suggestion? Maybe it's a bug?

    The answer lies in the same article that you are looking to:

    http://KB.VMware.com/selfservice/documentLinkInt.do?micrositeID=&popup=true&LanguageID=&externalID=2033096

    The script of vCenter 5.1 to create this task (job_schedule1_mssql.sql) is supposed to create a job with a single step.  It seems that they have decided to remove the purge step and the rest of the procedure for her, but for some reason, that the work is not always updated and the stage of the procedure call (now missing).

    You can fix it by running the script job_schedule1_mssql.sql by the instructions in the article.

  • PLS-00201 error occurs when the batch a stored procedure in SQL * more

    I have a batch file to run a stored procedure and the coil results in file. When I enter orders manually in sql * plus the output works very well and my results are spooling in the output file. But when I run the same commands in the script I get an error batch.


    Any ideas?

    Stored procedure:

    create or replace procedure MMP (p_cursor in the SYS_REFCURSOR)

    as

    Start

    Open p_cursorfor select name, id from table;

    end;

    batch file 1:

    sqlplus-s user/pw@REPORTDV @sp_output_spooled.sql

    sp_output_spooled.SQL script file

    Paste these commands directly on the SQL * more guest wraps the result as expected the value leader.

    the colsep value ' |'

    trigger the echo

    Set feedback off

    termout off Set

    set the position

    set linesize 9000

    set pagesize 0

    Set trimspool on

    headsep off Set

    output of the coil. TXT

    var refcursor rc

    run MMP(:rc)

    print the rc

    spool off

    output

    Errors printed to the output. TXT file after the batch is executed and error occurs:

    BEGIN MMP(:rc); END;

    *
    ERROR on line 1:
    ORA-06550: line 1, column 8:
    PLS-00201: identifier 'MMP' must be declared.
    ORA-06550: line 1, column 8:
    PL/SQL: Statement ignored


    ERROR:
    ORA-24338: statement handle not executed


    SP2-0625: variable printing error "rc".

    Hello

    Your code worked fine for me.

    Procedure MMP is owned by the same user that runs the batch file or does it means and appropriate privileges?

    VR,

    Sudhakar

Maybe you are looking for

  • Cannot set the time on the lock screen in iOS 10

    I guess that's a stupid question, but that's. I've just updated to iOS 10 days previously. Previously, I had my iPhone value never expire and go to the lock screen. I prefer to leave the phone on until I'm ready to turn it off. After the iOS upgrade,

  • Is it possible to install Firefox on Epson Moverio BT - 100 Android 2.2?

    Dear Firefox team,I am trying to install Firefox on an Epson Moverio BT-100 HMD. I don't want to use Google game store. Is it possible to install it?The Android version is froyo 2.2. Thank youGreetingsAaron

  • I can receive only a single tab to open when it is open, I can't close

    When Thunderbird opens it opens my bizz... folder and I can't shut it down or to go to a different folder or to my email. there is no ( what i call a back button) thanks tlp53

  • The file or directory is corrupted or unreadable

    I have a number of empty folders on an external hard drive that I want to delete. I managed to delete the files in these folders individually, but get the following message... "' Can't delete # the file or directory is corrupted or unreadable", when

  • kb2481109 fails to install

    Someone has any idea how to solve this problem? [KB2481109.log]0.922: ================================================================================0,922: 2011/03/09 (local) 13:54:16.9680,922: e:\0e9e418c13341cc50962b7aea1b0bb\update\update.exe (ve