Stored procedure ignore the synonym

I have defined 2 user : usr1 and usr2 and I have 2 table table1 and table2.
I define one synonym for table1 that for the usr2 is link to table2.
If I run sqlplus80 connect whit usr1 and I execute 'Select * from table1'
the query run correctly on table1.
If I run sqlplus80 connect whit usr2 and I execute 'Select * from table1'
the query run correctly on table2.
After I wrote a stored procedure with the same query.
If I execute the strored procedure from sqlplus80 connect with usr1 It work correclty with table1.
If I execute the stored procedure from sqlplus80 connect with usr2 It don't work because contine to work with table1, it seem that don't use the synonym.
Can someone help me ?

Please repost this question in the appropriate section of the Discussion Forum.
This forum is for general suggestions and feedback about the OTN site. For technical question about an Oracle product,
You can also use our new offering called OTN Service Network:
For Oracle Advice/Minimal Support (fee based) on Reports, Forums,
SQL*Plus, and PL/SQL, please go to: http://www.oracle.com/start/otnServiceNetwork/intro.html?src=9123 86&Act=6
For customers with paid support (Metalink) please go to:
http://www.oracle.com/support/metalink

Similar Messages

  • Stored procedure ignore synonym

    I have defined 2 user : usr1 and usr2 and I have 2 table table1 and table2.
    I define one synonym for table1 that for the usr2 is link to table2.
    If I run sqlplus80 connect whit usr1 and I execute 'Select * from table1'
    the query run correctly on table1.
    If I run sqlplus80 connect whit usr2 and I execute 'Select * from table1'
    the query run correctly on table2.
    After I wrote a stored procedure with the same query.
    If I execute the strored procedure from sqlplus80 connect with usr1 It work correclty with table1.
    If I execute the stored procedure from sqlplus80 connect with usr2 It don't work because contine to work with table1, it seem that don't use the synonym.
    Can someone help me ?

    Hi,
    I think u made PRIVATE synonym and no PUBLIC one...
    Good Luck,
    Fred

  • Adding a stored procedure to the master database?

    I have a SQL server instance being used as our data warehousing environment. The instance consists of several databases that I am snapshotting as part of our high availability strategy for data. I've created a stored procedure that takes the source database
    as an argument and that will create a new snapshot when a new one needs to be created and will also automatically remove the old snapshot. It also updates some synonym tables that point to the new snapshot but that might not be an important detail.
    I would like to have the stored procedure stored some place global to all of the databases that I am routinely snapshotting, but that would mean putting it in the master database. Although having it there makes things significantly better in terms of usability,
    it seems like there's something wrong with putting any stored procedures in the master database. Am I wrong? Is it OK to put stored procedures there in situations like this?

    Yes Database snapshot. We're using it to make our data more available so that when we're refreshing the underlying database we can still access the previous version of the data. Otherwise our reports and applications won't have access to the data or will
    get partial data sets. We don't intend to use it for DR or as a backup.
    ok. if it is for temporary purpose, it will work..
    you can create one master procedure and do that - master database. but you need to make sure you point your applications/reports to the snapshot database and not actual database
    Hope it Helps!!

  • Adding a stored Procedure to the Report

    Hi,
    I am developing a report using crystal plugin in eclipse.I have problems in adding a stored procedure to the report .I write the following command in SQL SCRAPBOOK dbo.StoredProcedure @Param1="param1",@Param2="param2",@Param3="None" and run it. It runs successfully ,but when i try to add it to report nothing is being added to it.
    I am using a Sybase database and driver(com.sybase.jdbc3.jdbc.SybXADataSource)
    Any suggestions regarding this would be of great help.
    Thanks in advance
    Siva
    Edited by: Siva_velicheti on Jun 1, 2010 12:10 PM

    Hmm, not sure about stored procedures, but you can get SQL queries to work like below....
    @method to get ResultSet from SQL query with user, pwd, and dbConnectionInfo
    @param query, scrollType, user, password, dbName, db
    @throws SQLException 
    @throws ClassNotFoundException
             private static ResultSet getResultSetQueryDBInfo(String query, int scrollType, String user, String password, String dbName, String db)
             throws SQLException, ClassNotFoundException
                  String DBUSERNAME =  user;
                  final String DBPASSWORD = password;
                  final String CONNECTION_URL = "jdbc:oracle:thin:@" + dbName + ":1521:" + db;
                  Connection connection = DriverManager.getConnection(CONNECTION_URL, DBUSERNAME, DBPASSWORD);
                  DatabaseMetaData meta = connection.getMetaData();
                  System.out.println("getResultSetQueryDBInfo - Connected to URL : " + meta.getURL());
                  System.out.printf("getResultSetQueryDBInfo - as user: %s\n", meta.getUserName() );
                  Statement statement = connection.createStatement(scrollType, ResultSet.CONCUR_READ_ONLY);
                  System.out.println("getResultSetQueryDBInfo method - executing query: \n");
                  return statement.executeQuery(query);

  • Java web service to invoke a stored procedure in the database

    Hi
    Does anybody have a example Java web srevice to invoke a stored procedure in the database
    regards
    Edited by: hrishy on May 20, 2011 12:11 AM

    hrishy wrote:
    Thanks i have modified the title so its easy to comprehendWrite the two parts mentioned above and post if you get problems with your code.
    First write code that calls the stored procedure and test that to make sure that it works.
    Then write a simple webservice and test it out to make sure it works. The integration should be trivial after that.

  • How to execute stored procedure in the SQL Commands page

    i'm oracle express edition newbie :) i have this stored procedure. it not belong to a package.
    create or replace procedure "LIST_MEMBERS"
    ("MEMBER_CUR" OUT SYS_REFCURSOR)
    is
    begin
    OPEN MEMBER_CUR FOR
    SELECT * FROM members;
    end;
    now, in the SQL Commands page, how to run the stored procedure and return the records. i do this:
    begin
    execute list_members();
    end;
    but i'm getting some errors. just need some immediate help :) thanks!!!

    Example of using a ref cursor:
    SQL> ed
    Wrote file afiedt.buf
      1  create or replace procedure open_cur(c IN OUT SYS_REFCURSOR) is
      2  begin
      3    open c for 'select rownum rn from dual connect by rownum <= 10';
      4* end;
    SQL> /
    Procedure created.
    SQL> ed
    Wrote file afiedt.buf
      1  declare
      2    c     SYS_REFCURSOR;
      3    v_val NUMBER;
      4  begin
      5    open_cur(c);
      6    loop
      7      fetch c INTO v_val;
      8      exit WHEN c%NOTFOUND;
      9      dbms_output.put_line(v_val);
    10    end loop;
    11    close c;
    12* end;
    SQL> /
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    PL/SQL procedure successfully completed.
    SQL>

  • Calling a stored procedure with the DI API in 6.5

    Hi,
    Is it possible to do this? I have the following lines of code...
        sSQL = "EXEC sp_AgedDebtForCustomerStatement"
        oRecordset.DoQuery sSQL
    This procedure runs fine in SQL Query Analyzer and the query generator in B1. When I use it in my VB app, it just crashes, without returning any error message.
    I have tested the exact same app on a 2004 version with no issues.
    Is it possible to use stored procs with the 650098 DI API?
    Thanks for any help,
    Robin

    Hi Frank,
    Thanks for your reply.
    Regarding the points you make...
    1) I have come across this before and thought it would be different.
    2) I am using error handling - that is what is so strange - it justs completely bombs out at that line.
    3) I tried this with the same result/error.
    I may just run the query not using the DI API - could be my only option.
    Thanks,
    Robin

  • Is it possible to execute a stored procedure using the JDBC adapter?

    Hi all,
    Can anybody confirm whether we can execute a stored procedure created in a database using the processing parameters of a JDBC adapter of a communication channel?
    If yes, then please let me know how (may be with an example)
    Thanks.

    Yes, that is possible. You have to chose EXECUTE in the action field to execute the stored procedure. Here's a little piece on the JDBC receiver:
    JDBC Receiver
    For writing data to an SQL database you also need to define a strict data type. The general format is like this:
        <ns:MT_RECORDSET>
              <STATEMENT>
                   <TABLE_NAME ACTION="">
                        <TABLE/>
                        <ACCESS>
                             <FIELD1/>
                             <FIELD2/>
                             <FIELDn/>
                        </ACCESS>
                        <KEY>
                             <ID compareOperation=""/>
                             <FIELDx compareOperation=""/>
                        </KEY>
                   </TABLE_NAME>
              </STATEMENT>
    </ns:MT_RECORDSET>
    This recordset represents an SQL statement like "update TABLE1 set FIELD1=123, FIELD2=456, FIELDn='xyz' where ID=12345 and FIELDx is NULL"
    MT_RECORDSET is the name of the Message Type used.
      For the value of the attribute ACTION you can choose from the following values:
         UPDATE : updates the given fields in the table with their new values
         INSERT : insert the given fields as a new row in the table
         UPDATE_INSERT : insert rows in the table when update is not possible
         DELETE : deletes given fields from the table
         SELECT : selects given fields from the table. Note that this option returns a response in the JDBC Sender form!
         EXECUTE : execution of a stored SQL procedure
         SQL_QUERY | SQL_DML : option to transfer more complex SQL statements to the database
      The attribute compareOperation can have the following values:
         EQ : equal
         NEQ : not equal
         LT : less than
         LTEQ : less than or equal to
         GT : greater than
         GTEQ : greater than or equal to
         LIKE : used to compare strings

  • Can't see my Oracle stored procedure in the avalable data source list

    Post Author: Moori
    CA Forum: Data Connectivity and SQL
    Hello All,
    I've created an Oracle stored procedure which I need to use it's returned data in my crystal report but I can't find it in the data source list.
    I'm using the same schema & database and user as my sp was created on.
    Please advise.
    Moori

    Jim (also Geoff and Hal)-
    Still haven't solved this. Here's another try at a screenshot, showing just below this text for me, of my Library interface showing the C drive listed in the left panel and not showing the C drive contents. Only, as you said is intended, what is already in Lightroom.
    I thought if I was not in "Catalog" I had been able, in the past, to select from anything in my C crive simply by opening that folder in the panel.
    When I click import it is usually - from memory - to start the import of the already selected items. For a time that's what was happening from the above screen if I selected Import. It would apparently start re-importing the selected items and without presenting the usual familiar dialog asking about file naming, etc. Now, however, clicking Import bring up this:
    Never saw this black horizontal dialog box before this situation arose. I was able to import but not as usual and I would like to get back the square (moreso at least) "white" dialog box. No clue what's going on or how to get bact to familiar ground. Ideas?

  • Using a Stored Procedure with the DBUM connector

    Hello, I am a new to the Oracle Identity Manager. The system I am running on is Windows Server 2008. I have recently installed version 11.1.1.3.0 of the Identity and Access Management suite, along with the appropriate components. I am using an 11g R2 database as my repository. I have installed the DBUM connector, and have successfully provisioned a user to my database (which is also an Oracle database).
    However, I have an instance where I need to not only provision a database user account, but also that user's ID and password (after running some arbitrary function to it, such as appending a 1 or hashing it) to a table located within that same database.
    Could someone please give me a high-level description of what I need to do to accomplish this, and possibly point me in the direction of some documentation? I greatly appreciate it.

    You can write your own custom code to run a stored procedure. Here is documentation for it: http://download.oracle.com/javase/tutorial/jdbc/basics/storedprocedures.html
    Create your code, and deploy your jar file to the xellerate/JavaTasks folder. Create an adapter to use the code. Then on your provisioning process definition create a new task and attach the adapter. Finally, trigger the task off the create user task.
    -Kevin

  • How to execute an stored procedure from the Report Region

    Have stored procedure "LER_KRONOS_PAYCODE_HOURS_P" compiled and ready.
    (previously tested)
    Region Source:
    DECLARE
    v_SITE_ID VARCHAR2(8);
    v_SDATE VARCHAR2(8);
    v_EDATE VARCHAR2(8);
    v_LEVEL3 VARCHAR2(60);
    BEGIN
    v_SITE_ID :=P4_SITES_LOV;
    v_SDATE :=P4_SDATE;
    v_EDATE :=P4_SEDATE;
    v_LEVEL3 :=P4_LEVEL3;
    EXECUTE LER_KRONOS_PAYCODE_HOURS_P(v_SITE_ID,v_SDATE,v_EDATE,v_LEVEL3);
    END;
    Error When run the page:
    ORA-06550: line 11, column 12: PLS-00103: Encountered the symbol "LER_KRONOS_PAYCODE_HOURS_P" when expecting one of the following: := . ( @ % ; immediate The symbol ":=" was substituted for "LER_KRONOS_PAYCODE_HOURS_P" to continue.

    You need the execute keyword only when you run it directly from sqlplus.. that will tell sqlplus to append the keyword begin and end after the procedure call.
    Example.
    SQL > exec proc1 (input1);
    will tell sqlplus to run it as a block.. saying
    sql> Begin
              proc1(input1);
          end;Inside the procedure , in your code, you dont need the execute keyword.
    But, why do you want to execute a procedure inside the source for a report region..?

  • Stored Procedure killed the root blocker in rac 10g

    Hi every one,
    I need the procedure that killed root blocker in RAC environmental 10g,
    I found the stored procedure for 11g which simple but 10g required some expertise
    because I want to just exec [procedure] it will kill root blocker either locally and remote node
    thanks a lot
    Edited by: user11688837 on Jan 30, 2013 10:08 AM

    I Checked your link as for regarding 11g RAC its find. But for the regarding 10g it will never work on
    remote node you have to used only and only dbms_job.sumbit to kill remote node.
    your kind information please rectify the commend that it will work on local node not on remote node in 10g
    'ALTER SYSTEM KILL SESSION '||a.sid||','||a.serial#||''' IMMEDIATE;' as "10g Command to kill session",
    thankyou
    Edited by: user11688837 on Jan 30, 2013 10:06 AM
    Edited by: user11688837 on Jan 30, 2013 10:26 PM

  • How to extract the details of the stored procedures in the database?

    Dear all,
    How to extract the details of them?
    Bst Rgds,
    Edward

    Hi Wa-Man Edward Chan,
    Following is the PLSQL Block Which Will Give Package, Procedure, Function Source
    set verify off
    undefine which_object;
    undefine which_line;
    declare
    Shows lines with context of:
    VIEW
    FUNCTION
    PROCEDURE
    TRIGGER
    PACKAGE SPECIFICATION
    PACKAGE BODY
    The script uses to temporary tables ERROR_TABLE_TEMP and ERROR_CLOB_TEMP created with:
    CREATE GLOBAL TEMPORARY TABLE ERROR_TABLE_TEMP(line number, text varchar2(4000));
    CREATE GLOBAL TEMPORARY TABLE ERROR_CLOB_TEMP(TEXT CLOB);
    v_offset number:= 5; -- Controls how many lines before and after the line in focus are to be shown
    v_obj_name varchar2(100);
    v_obj_type varchar2(100);
    v_obj_type_new varchar2(100);
    v_obj_line number;
    v_counter number := 0;
    v_text varchar2(32767);
    v_subtext varchar2(1000);
    v_from number;
    v_len number;
    v_marker varchar2(10);
    v_found number;
    v_line_from number;
    v_line_to number;
    v_long_text clob;
    procedure ins_line (p_text in varchar2) is
    begin
    v_counter := v_counter + 1;
    insert into error_table_temp(line,text)
    values (v_counter,p_text);
    end;
    begin
    delete error_table_temp;
    select ltrim(rtrim(upper('&which_object'))), nvl(to_number('&which_line'),0)
    into v_obj_name, v_obj_line
    from dual;
    begin
    select decode(object_type,'PACKAGE','PACKAGE BODY',object_type)
    into v_obj_type
    from user_objects
    where object_name = v_obj_name
    and nvl(v_obj_line,0) > 0
    and rownum = 1;
    exception when no_data_found then
    ins_line('ERROR: Object/line not found');
    return;
    end;
    ins_line(v_obj_name||' ('||v_obj_type||')');
    if v_obj_type in ('PACKAGE BODY','PACKAGE','FUNCTION','PROCEDURE') then
    v_obj_type_new := v_obj_type;
    ins_line('----------------------- PROGRAM LISTING -------------------------');
    for code in (select trim(text) text, lpad(line,4,' ')||' '||decode(line,v_obj_line,'>>>>> ',' ') marker, type
    from user_source
    where name = v_obj_name
    and line between v_obj_line-v_offset and v_obj_line+v_offset
    order by decode(type,v_obj_type,1,2),line) loop
    if v_obj_type_new != code.type then
    ins_line(null);
    v_obj_type_new := code.type;
    v_counter := -100000; -- In order to show specification before body
    ins_line(v_obj_name||' ('||v_obj_type_new||')');
    ins_line('----------------------- PROGRAM LISTING -------------------------');
    end if;
    ins_line(code.marker||code.text);
    end loop;
    elsif v_obj_type = 'VIEW' then
    select text
    into v_text
    from user_views
    where view_name = v_obj_name;
    v_line_from := v_obj_line-v_offset;
    v_line_to := v_obj_line+v_offset;
    v_obj_line := v_obj_line -1;
    ins_line('------------------------------- PROGRAM LISTING -------------------------------');
    for i in v_line_from..v_line_to loop
    begin
    if i = v_obj_line then
    v_marker := '>>>>> ';
    else
    v_marker := ' ';
    end if;
    if i = 0 then
    v_from := 0;
    v_len := instr(v_text,chr(10));
    else
    v_from := instr(v_text,chr(10),1,i);
    v_len := instr(v_text,chr(10),1,i+1) - v_from;
    end if;
    v_subtext := substr(v_text,v_from+1,v_len-1);
    if v_len > 0 then
    ins_line(lpad(to_char(i+1),4,' ')||' '||v_marker||v_subtext);
    end if;
    exception when others then
    null;
    end;
    end loop;
    elsif v_obj_type = 'TRIGGER' then
    ins_line('----------------------- PROGRAM LISTING -------------------------');
    delete error_clob_temp;
    execute immediate 'insert into error_clob_temp (text) '||
    'select to_lob(trigger_body) '||
    'from user_triggers ' ||
    'where trigger_name = '''||v_obj_name||'''';
    select text
    into v_long_text
    from error_clob_temp;
    v_obj_line := v_obj_line-1;
    v_line_from := v_obj_line-v_offset;
    v_line_to := v_obj_line+v_offset;
    for i in v_line_from..v_line_to loop
    begin
    if i = v_obj_line then
    v_marker := '>>>>> ';
    else
    v_marker := ' ';
    end if;
    if i = 0 then
    v_from := 0;
    v_len := dbms_lob.instr(v_long_text,chr(10));
    else
    v_from := dbms_lob.instr(v_long_text,chr(10),1,i);
    v_len := dbms_lob.instr(v_long_text,chr(10),1,i+1) - v_from;
    end if;
    v_subtext := dbms_lob.substr(v_long_text,v_len-1,v_from+1);
    if v_len > 0 then
    ins_line(lpad(to_char(i+1),4,' ')||' '||v_marker||v_subtext);
    end if;
    exception when others then
    null;
    end;
    end loop;
    end if;
    if v_counter = 0 then
    ins_line('*********** NO CODE FOUND ***********');
    else
    ins_line(null);
    end if;
    exception when others then
    ins_line('*********** ERROR: NOT POSSIBLE TO SHOW THE CODE ***********');
    ins_line(' FEJL: '||sqlerrm);
    end;
    set linesize 4000
    set heading off
    set feedback off
    set verify on
    select text
    from error_table_temp
    order by line;
    set linesize 80
    set heading on
    set feedback on
    Prashant

  • Call to PL/SQL Stored Procedure in the HTML expression field

    Hi,
    I need to display an image in a report based on the value of the underlying field. (Y/N)
    I created a solution based on http://www.dba-oracle.com/t_easy_html_db_display_image_html_expression.htm
    Unfortunately this does not work for me. The PL/SQL written in the HTML expression field is not being executed. The result is something like : <img src="PKG_IMAGES.display_YN_checkmark_image?p_image=Y">
    What am I missing?
    Tx for your help.

    kcaluwae wrote:
    Hi,
    I need to display an image in a report based on the value of the underlying field. (Y/N)
    I created a solution based on http://www.dba-oracle.com/t_easy_html_db_display_image_html_expression.htm
    Unfortunately this does not work for me. The PL/SQL written in the HTML expression field is not being executed. The result is something like : <img src="PKG_IMAGES.display_YN_checkmark_image?p_image=Y">
    What am I missing?Ensure that the Display As Column Attribute for the report column is Standard Report Column.
    However, the linked article appears to be very out of date. If using APEX 3.1 or later, see About BLOB Support in Forms and Reports for a better alternative.
    There's an OBE tutorial that followed the introduction of declarative BLOB support in 3.1 as well. (That might be an earlier version but it is still relevant to APEX 4.x.)

  • How to pass the parameter of a stored procedure to iReport

    Hi... i don't know how to pass the parameter of the stored procedure to the iReport.
    In the Report Query, i tried
    1. sp_storedprocedure ' value'
    2. sp_storedprocedure +''''+$P{parameter}+''''+
    3. sp_storedprocedure +$V+$P{parameter}++$F($F is a variable having a value of ' (a single quote))may you enlighten us please? thank you

    For M$ SQL server I find that it only works when U use the fully qualified name...
    e.g. catalod.dbo.my_procedure_name 'variable'
    My full query in the Report Query window is something like this:
    EXEC arc.dbo.jasper_Invoice 1000
    Note that you may find that selecting from VIEWS / TABLES fails for no apparent reason and iReport will prompt you with the usual very unhelpful (we have what we "pay" for) prompt, stating that "The document is empty".
    To work around this issue, where a statement like "SELECT * FROM arc.dbo.acc_invoices WHERE Invoice_id=1000" does not work, simply create a PROC, something like:
    CREATE PROC jasper_MyProc (@my_rec_id integer) AS
    SELECT * FROM arc.dbo.acc_invoices WHERE Invoice_id= @my_rec_id integer
    ...to wrap your SELECT statement, then call the PROC
    Edited by: Sylinsr on Apr 22, 2008 4:23 PM

Maybe you are looking for

  • Address field data is not getting dispalyed in company details

    Dear All, After filling up the necessary details in the Administration->system initialization->company details->general tab->Local language for the address of the company. I am not getting the address displayed in the Address field. I have filled all

  • Can others verify this bug in Pages 5.0.1?

    I think I've found a bug, but would like to see if others here can replicate it. Running OS X 10.9.1, do the following: 1) Launch Pages 5.0.1 2) Open/Create a New Document 3) Go to Edit-->Spelling and Grammar and Check ON "Correct Spelling Automatica

  • Egads, Backups Have Disappeared.

    Egads, I was already dealing with a problem of unexplained massive re-backups. Now several of my backups have disappeared, or at least are unaccessible. When last I checked yesterday, I had a continuous line of backups going back to November 21st. Wh

  • Help lost my music!!

    I am fairly new to itunes and never wanted to use it because it is very constraining and restrictive (i think)let me tell you how: I had a bunch of albums that I bought through itunes and a bunch of music that i copied out of my cds well last week I

  • I am using iPhone 5s ,I paid $188 ,but I can't use PDF to work file this function ,it is sucks app

    I am using iPhone 5s ,I paid $188 ,but I can't use PDF to work file this function ,it is sucks app.i will complain apple of you app