Stored Procedure to Block Changing of a particular UDF Field by a particular USER ID

Hi,
I have a case where a particular UDF Field in Sales Order  must not be changed by a particular USER ID.
My SP is,
IF @object_type='17' AND ( @transaction_type='U')
BEGIN
  if(Select T0.XXX  from ORDR T0
  where T0.UserSign='1' and T0.DocEntry=@list_of_cols_val_tab_del)>0
  begin
  SET @error = 1
     SET @error_message= 'You Cannot Change this Field'
  GOTO EXITLINE
  end
end
It throws me with the Error : -
[Microsoft][SQL Server Native Client 10.0][SQL Server]Conversion failed when converting the nvarchar value 'ABC' to data type int. (CINF)
The UDF Field is Alphanumeric in type.
Can any one please suggest me what could be the error.
Thanks

Hi Gopi Krishnan,
Please check below SP Transaction Notification.
if @object_type = '17' and @transaction_type in ('U')
begin
If Exists (SELECT T0.[DocEntry] FROM ORDR T0 
INNER JOIN RDR1 T1 ON T0.[DocEntry] = T1.[DocEntry]
INNER JOIN OUSR T2 ON T0.[UserSign] = T2.[USERID]
WHERE T0.[UserSign] = '1'  AND T0.DocEntry = @list_of_cols_val_tab_del)
    Begin
        SET @error = 1002
        SET @error_message = N'You are not Authorized to Update Sales Order'
    End
End
Hope this help
Regards::::
Atul Chakraborty

Similar Messages

  • How to use order by in stored procedure base block?

    How to use order by in stored procedure base block? I need to change order by dynamically

    Use SET_BLOCK_PROPERTY('BLOCK_NAME',ORDER_BY,'COLUMN_NAME1, COLUMN_NAME2');

  • Stored Procedure To Block if A/R Delivery Qty Qty in Sales Order

    Hi Experts,
    Can we Block to post the A/R Delivery Document if the quantity is greater than the quantity mentioned in the Sales order (Base Document).
    If We can Please Help me with the procedure
    With regards,
    G.Eshvanth Singh

    Hi,
    Here is a store procedure to block delivery creation if its qty is exceeding SO qty:
    IF @transaction_type IN (N'A', N'U') AND
    (@Object_type = N'20')
    begin
    if exists (SELECT T0.BaseEntry, SUM(T0.Quantity)
    FROM [dbo].[DLN1] T0 INNER
    JOIN [dbo].[RDR1] T1 ON T1.DOCENTRY =
    T0.BASEENTRY
    WHERE T0.BaseType = 22 AND T0.ItemCode =
    T1.ItemCode AND T0.BaseLine = T1.LineNum
    and T0.DOCENTRY = @list_of_cols_val_tab_del
    GROUP BY T0.BaseEntry
    HAVING (SUM(T0.Quantity) > SUM(T1.Quantity)) or sum(t0.quantity) > sum(t0.BaseOpnQty))
    begin
    select @Error = 10, @error_message = 'GRPO
    quantity is over PO quantity'
    end
    end
    you place the SP_TN into your SQL server SBO company database programmability --> system store procedures --> dbo.SBO_SP_TransactionNotification --> right click this dbo --> select Script stored Procedure as select Alter to New query editor,
    the result will be as follows:
    @object_type nvarchar(20), -- SBO Object Type
    @transaction_type nchar(1), -- [A]dd, <u>pdate, [D]elete, [C]ancel, C[L]ose
    @num_of_cols_in_key int,
    @list_of_key_cols_tab_del nvarchar(255),
    @list_of_cols_val_tab_del nvarchar(255)
    AS
    begin
    -- Return values
    declare @error int -- Result (0 for no error)
    declare @error_message nvarchar (200) -- Error string to be displayed
    select @error = 0
    select @error_message = N'Ok'
    -- ADD YOUR CODE HERE
    -- Select the return values
    select @error, @error_message
    end
    GO
    There are five out parameters:
    Put the code I have given in the -- ADD YOUR CODE HERE part.
    let me know your e-mail address if you want to have SP_TN pdf file from SAP
    Rgds,

  • Stored Procedure to block cost center or profit center to present in JE

    Hi ...
    I have a case where i need to block if either one of the cost center or the Profit Center is not present in the manual journal entry.
    Below is my Stored Procedure which i have written....My Problem is that this block allows me to update only if both the Cost Center and the Profit Center is Present and does not allow if any one is present.
    IF @object_type='30' AND (@transaction_type='A' or @transaction_type='U')
    BEGIN
      if(Select Count(*) from OJDT T0  INNER JOIN JDT1 T1 ON T0.TransId=T1.TransId
      INNER JOIN OACT T2 ON T2.AcctCode=T1.Account
      where  T2.ExportCode LIKE '1%' And (isnull(T1.ProfitCode,0)='0'  OR ISNULL(T1.OcrCode2,'')='')  and
       T0.TransId=@list_of_cols_val_tab_del)>0
      begin
      SET @error = 0201
         SET @error_message= 'R1'
    end
    end
    What could be the problem...?

    Hi Gopi
    Try This
    IF @transaction_type IN ('A','U') and @Object_type = 30
    BEGIN
    IF EXISTS (SELECT T0.TransId FROM dbo.JDT1 T0
    WHERE ((T0.ProfitCode ='' OR T0.ProfitCode IS NULL) and (T0.[OcrCode2]='' OR T0.[OcrCode2] IS NULL) and (T0.[OcrCode3]='' OR T0.[OcrCode3] IS NULL) and
    (T0.[OcrCode4]='' OR T0.[OcrCode4] IS NULL) and (T0.[OcrCode5]='' OR T0.[OcrCode5] IS NULL)) AND T0.TransId = @list_of_cols_val_tab_del)
    Begin
    SET @Error = 1111
    SET @error_message = 'At least one cost center is mandatory!'
    End
    End
    With Regards
    Balaji Sampath

  • Oracle Forms' Stored Procedure Data Blocks

    i'm using the 6i demo procedure code to populate the data from the peocedure. it is retrieving data fine. but whn it will creates the following procedure. onece it shows me only insert procedure but after that i didnt find any procedure.
    Query-procedure
    Insert-procedure
    Update-procedure
    Delete-procedure
    Lock-procedure
    thanks in advance
    Shakeel

    yes i know insert, update delete and lock proceduer are written on the procedure packege but after block wizard these procedure automerically created on block level.

  • Stored Procedure for Blocking from using a Specific Warehouse in any transaction

    Hi,
    Is it possible to write a SP from using a Specific Warehouse in any transaction ?

    Hi,
    Try this SP for sales order. Change 01 to your warehouse code
    IF @transaction_type in ('A','U') AND (@OBJECT_TYPE='17')
    BEGIN
    IF  exists (SELECT t1.docentry  FROM ORDR T0  INNER JOIN RDR1 T1 ON T0.DocEntry = T1.DocEntry  WHERE T1.[WhsCode] = '01'  and
    t0.docentry =  @list_of_cols_val_tab_del )
    Begin
    SET @error = 123
    SET @error_message = 'Check warehouse code'
    End
    End
    Thanks & Regards,
    Nagarajan

  • Stored Procedure to block DN for specified BP unless ODLN.NumAtCard contain 6-digit number

    Hello experts
    I am trying to us SPTN block delivery for specified BP unless supplier reference field contains 6 digit number (this is Customer PO number format)
    --Block CCOR001 DN unless 6 figure number in ODLN.NumAtCard
    IF @object_type = '15' AND @transaction_type = 'A'
    BEGIN
    IF EXISTS(SELECT T0.[Docentry] FROM ODLN T0 WHERE T0.[CardCode] = 'CCOR001' AND T0.[NumAtCard] != ###### AND T0.docentry = @list_of_cols_val_tab_del)
    SELECT @error = 1, @error_message = N'Cannot deliver without 6 digit Purchase Order number'
    END
    I am working on above query needing assistance with how to specify 6-digit number here ###### ?
    Regards,
    Karen

    Hi Nagarajan,
    Thank you for assistance these queries are functioning well and due to improving knowledge I have added another condition to because when I tested I discover it is possible to add DN by putting "Verbal" in the field. Because we have many customers who do not require formal purchase orders it is necessary to block 'Verbal' and 'To be confirmed' 'TBC' 'follow' and so on.
    Here is query: It seems to work fine with basic testing so far..
    IF @object_type = '15' AND @transaction_type IN ('A','U')
    BEGIN
    IF EXISTS(SELECT T0.[Docentry] FROM ODLN T0 WHERE T0.[CardCode] = 'CCOR001' AND T0.[NumAtCard] is null AND ISNUMERIC( T0.NumAtCard ) = 0 OR LEN(CAST(T0.[NumAtCard] As nvarchar(4000))) <> 6 AND T0.docentry = @list_of_cols_val_tab_del)
    SELECT @error = 1, @error_message = N'Cannot deliver without 6 digit Purchase Order number'
    END

  • GRPO Stored Procedure Block for Cost Discrepancy

    Dear Experts,
    I am in the process of writing a stored procedure to block a GRPO from posting if one of the items' prices has a 30% discrepancy on item cost.
    I couldn't use AvgPrice as the value in the table considers the transaction being processed. What I am trying to do is compare the price with the previous GRPO's price done for this item.
    Any other suggestions would be great.
    Now this works fine until I add a second item on the document or even the same item twice. It will only apply block to item on first row.
    SP will only block first row in example below:
    #1 Item A 50.00
    #2 Item B 100.00
    #3 Item A 10.00
    I was wondering how the block can look at the individual lines, alternatively has anyone done something similar that can help me.
    Query:
    --Block Goods Receipt PO with 30% Price Discrepancy
    declare @item nvarchar(255)
    select @item = NULL
    IF @TRANSACTION_TYPE = 'A' AND @OBJECT_TYPE = '20'
    BEGIN
    Select @item = A.ItemCode
    From
                   (SELECT 'itemcode' =
                        CASE --greater than
                             When (((T1.Price -
                                       --fetch prev price
                                       (SELECT max(b.price)
                                       from opdn a inner join pdn1 b on a.DocEntry = b.docentry
                                       where b.ItemCode = T1.itemcode AND
                                       a.DocNum =
                                       (SELECT MAX(a1.Docnum) from OPDN a1 inner join PDN1 b1 on a1.DocEntry = b1.DocEntry
                                       WHERE b1.ItemCode = b.ItemCode
                                       AND a1.docnum <
                                                 (SELECT MAX(a2.Docnum) from OPDN a2 inner join PDN1 b2 on a2.DocEntry = b2.DocEntry
                                                 WHERE b2.ItemCode = b1.ItemCode)
                                       --##fetch prev price     
                                       --fetch prev price
                                       (SELECT max(b.price)
                                       from opdn a inner join pdn1 b on a.DocEntry = b.docentry
                                       where b.ItemCode = T1.Itemcode AND
                                       a.DocNum =
                                            (SELECT MAX(a1.Docnum) from OPDN a1 inner join PDN1 b1 on a1.DocEntry = b1.DocEntry
                                            WHERE b1.ItemCode = b.ItemCode
                                            AND a1.DocNum < (
                                            (SELECT MAX(a2.Docnum) from OPDN a2 inner join PDN1 b2 on a2.DocEntry = b2.DocEntry
                                                 WHERE b2.ItemCode = b1.ItemCode)
                                       --##fetch prev price     
                                       ) * 100) >= 30
                                  Then T1.ItemCode
                                  --smaller than
                                  When (((T1.Price -
                                       --fetch prev price
                                       (SELECT max(b.price)
                                       from opdn a inner join pdn1 b on a.DocEntry = b.docentry
                                       where b.ItemCode = T1.itemcode AND
                                       a.DocNum =
                                       (SELECT MAX(a1.Docnum) from OPDN a1 inner join PDN1 b1 on a1.DocEntry = b1.DocEntry
                                       WHERE b1.ItemCode = b.ItemCode
                                       AND a1.docnum <
                                                 (SELECT MAX(a2.Docnum) from OPDN a2 inner join PDN1 b2 on a2.DocEntry = b2.DocEntry
                                                 WHERE b2.ItemCode = b1.ItemCode)
                                       --##fetch prev price     
                                       --fetch prev price
                                       (SELECT max(b.price)
                                       from opdn a inner join pdn1 b on a.DocEntry = b.docentry
                                       where b.ItemCode = T1.Itemcode AND
                                       a.DocNum =
                                            (SELECT MAX(a1.Docnum) from OPDN a1 inner join PDN1 b1 on a1.DocEntry = b1.DocEntry
                                            WHERE b1.ItemCode = b.ItemCode
                                            AND a1.DocNum < (
                                            (SELECT MAX(a2.Docnum) from OPDN a2 inner join PDN1 b2 on a2.DocEntry = b2.DocEntry
                                                 WHERE b2.ItemCode = b1.ItemCode)
                                       --##fetch prev price     
                                       ) * 100) <= -30
                                  Then T1.ItemCode
                                  end
                        FROM [DBO].[OPDN] T0 INNER JOIN [DBO].[PDN1] T1 ON T0.DocEntry = T1.DocEntry INNER JOIN OITM T2 on T1.ItemCode = T2.Itemcode     
                        --AND NOT T0.UserSign = 1 --Manager
                        AND T1.DOCENTRY = @LIST_OF_COLS_VAL_TAB_DEL) A
    IF EXISTS
    (Select @item where @item is not NULL)
         BEGIN
              SELECT @ERROR = 2, @ERROR_MESSAGE = 'Price Discrepancy too large. Please check item:' + ' ' + @item
         END
    END
    Thanks,
    Adriaan

    That's a really tough form to create.
    Here's a couple of dynamic forms you can try out:
    By Francois Degrelle:   "DYNAMIC_FORM.fmb".
    And my old dynamic matrix Form is here:   QA: Quick Access  An Oracle Forms dynamic utility form

  • Block transaction in A/R Reserve Invoice via Stored Procedure

    Dear experts,
    I found in many threads the object id or object type of A/R Reserve Invoice to be 13 which is same as A/R Invoice. But when I use this object id in SP_Transaction_Notification stored procedure to block a transaction, A/R Reserve Invoice document is not affected by this object id. Also I noticed that the table the A/R Reserve Invoice is using is same as A/R Invoice.
    Can any one help on this issue?
    I want to block transaction to A/R Reserve Invoice as well as A/P Reserve Invoice if the line item's Item cost (OITM.AvgPrice) field is not specified in the Item Master Data.
    Regards
    Sanil

    Thanks a lot Gordon. I got the answer.

  • Deserialization permissions error in CLR stored procedure

    Environment: SQL Server 2008 R2 standard edition and VS2010, .Net Framework 3.5
    I've got a table with a varbinary column that contains a serialized Hashtable. I'm writing a CLR stored procedure that, given the contents of such a field from a row in the table, does a lookup on a key in the Hashtable. and returns the element's value.
    To get the Hashtable, I need to deserialize it, and it appears that the BinaryFormatter's Deserialize function requires certain permissions that I don't know how to grant.
    This SQL Server instance runs on my own development machine, and was installed pretty much with all defaults. I'm the owner.
    Any help on solving this? I should point out while I write a fair amount of SQL and a LOT of VB, I'm far from a SQL Server expert, so if you have suggestions I'd appreciate it if you'd spell things out clearly for me.
    Thanks in advance for any help,
    Tom
    Here's a fragment from the VB source:
        ' the bytes variable is defined as Byte()
        Dim ms As MemoryStream = New MemoryStream()
        ms.Write(bytes, 0, bytes.Length)
        ms.Seek(0, 0)
        Dim formatter As New System.Runtime.Serialization.Formatters.Binary.BinaryFormatter()
        Dim oHT As Object = formatter.Deserialize(ms)    'hurls here
    The CREATE ASSEMBLY statement had WITH PERMISSION_SET = SAFE. I tried it with UNSAFE, and got this error:
    CREATE ASSEMBLY for assembly 'ddmi.deep.data.sqlserver' failed because assembly 'ddmi.deep.data.sqlserver' is not authorized for PERMISSION_SET = UNSAFE.  The assembly is authorized when either of the following is true: the database owner (DBO) has
    UNSAFE ASSEMBLY permission and the database has the TRUSTWORTHY database property on; or the assembly is signed with a certificate or an asymmetric key that has a corresponding login with UNSAFE ASSEMBLY permission.
    Here's an SQL script that runs it:
    declare
        @id int
      , @raw_req_bin varbinary(1500)
      , @value nvarchar(max)
    set @id = 327
    set @raw_req_bin = (select raw_req_bin from dp_payment where transaction_id = @id)
    set @value = dbo.dp_fx_hash_table_lookup(@raw_req_bin, 'first_name')
    and here's what I get when I run the script:
    SecurityExceptionSystem.Security.SecurityException: Request for the permission of type 'System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.
       at System.Security.CodeAccessSecurityEngine.SpecialDemand(PermissionType whatPermission, StackCrawlMark& stackMark)
       at System.Security.CodeAccessPermission.DemandInternal(PermissionType permissionType)
       at System.Runtime.Serialization.Formatters.Binary.ObjectReader.Deserialize(HeaderHandler handler, __BinaryParser serParser, Boolean fCheck, Boolean isCrossAppDomain, IMethodCallMessage methodCallMessage)
       at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize(Stream serializationStream, HeaderHandler handler, Boolean fCheck, Boolean isCrossAppDomain, IMethodCallMessage methodCallMessage)
       at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize(Stream serializationStream)
       at ddmi.deep.data.sqlserver.UserDefinedFunctions.AsHashTable(Byte[] bytes, String& phase)
    The action that failed was:
    Demand
    The type of the first permission that failed was:
    System.Security.Permissions.SecurityPermission
    The Zone of the assembly that failed was:
    MyComputer

    Set the database (in a test system) to trustworthy (ALTER DATABSE foo SET TRUSTWORTHY ON) for testing. If this works, look into code signing (sign an assembly and catalog the cert/asymmetric key to master) for production. If you have problems with
    "native" serialization, you might get better results using XML serializers.
    Re: XML serializers. SQLCLR will not load dynamically generated serializers. So you need to pregenerate XML serializers with sgen.exe.
    Your specific error message (the permission error) might be fixed by cataloging the SQLCLR assembly as UNSAFE. If that doesn't work, you might attempt to change the .NET permission configuration on your machine using either of the tools described here:
    http://msdn.microsoft.com/en-us/library/7c9c2y1w(v=vs.90).aspx
    Hope this helps, Cheers, Bob

  • Subreport using the same Stored Procedure

    I have a main report and a subreport that uses the same stored procedure. The stored procedure has 12 parameters and what I want to avoid is the user having to enter the same parameter values twice. When I created the subreport I put in the parameters + one field, the employee id field so that I could just test it on one employee.
    After I entered the subreport into the main report, when I got to refresh the data, it's asking for params for BOTH reports. Is there any way to get around this? Because of the way the stored procedure returns the data, I had to create a subreport instead of just fitting it into one of the footers. I've looked at the subreport link and added the employee id as the key. When I ran it the first time, it returned the wrong date range on the sub.
    Help! this thing is Way passed due!!

    Right click on the sub report and choose change sub report links
    Top left pane contains your main report parameters use > to add
    In the bottom left corner of that dialog then scroll down until you see the corresponding sub report parameter
    Repeat for each parameter
    This should then take the main report params and pass into the sub report

  • Stored Procedure At Runtime !!!!

    Hi all,
    I want to create a stored procedure or function at run time!!
    Which mean when the user click a button, it will reflect a dynamically created stored procedure or function in the data base.
    But APex processes cannot do that,Can anyone help me??
    thanks & Regards,
    Ola

    Hi Lev,
    The user cannot enter any SQL or PL/SQL , he only can enter Mathematical equations like "a=100+(v*25)/2"
    where a and v are predefined variables, actually it is a dimmed text box and he drag and drop elements into it.
    Then I have to validate this equation before converting it to PL/SQL anonymous block or procedure.
    But my question is if i use anonymous blocks,how can i execute it later on
    for example if we saved the previous equation as 'e1' how can i say "x=e1(10)".
    Regards,
    Ola

  • Join relation with two sotred procedure based blocks

    Hi,
    I am working on a form with two DB stored procedure based blocks.
    It is like:
    BLOCK1: based on blk1_select(id1) (master)
    BLOCK2: based on blk2_select(id1) (details)
    The join condition is:
    BLOCK2.id1 = BLOCK1.id1 and BLOCK2.id2 = BLOCK1.id2
    here id1 is the parameter and id2 is the cursor item.
    The behavior that I expect is that when I do next_record in BLOCK1, the BLOCK2 with move to next record corresponding to id2, but this time BLOCK2 records stay as the same.
    The behavior is good for regular table base blocks and there must be something that I am not aware of.
    This FORM does query only, no insert, update and delete.
    Please help. Any suggestions are greatly appreciated.
    Thank.
    Jimmy
    Edited by: WJH on Feb 25, 2010 3:28 PM
    Edited by: WJH on Feb 25, 2010 3:44 PM
    Edited by: WJH on Feb 25, 2010 4:08 PM
    This FORM does query only, no insert, update and delete.

    If you have access to Metalink check out Document ID: 124650.1 (Master/Detail Relationship based on Stored Procedures).
    Hope this helps.
    Craig...
    If a response is helpful or correct, please mark it accordingly

  • Oracle 8..How to call stored Procedure to call stored Function

    Student here. Using Oracle 8, without Procedure Builder. Only have SQLPlus environment. Three simple code blocks follow:
    block One Creates a Function
    block Two Creates a Procedure
    ...However, I do not know how to Start, Run, Get..@ <or whatever command at SQL> prompt, to run the Procedure to call the Function.
    block Three is a script that calls the function, but I wish to call the stored procedure (from block Two above). My user manual PL/SQL Intro does not address.
    Please provide simple SQL Plus steps, command, path whatever.
    Very grateful to any or all who assist
    Wayne
    [email protected]
    -- CODE BLOCK #1 ----------------------------
    SQL>CREATE OR REPLACE FUNCTION COST_INCREASE_F (V_INCOMINGSAL NUMBER)
    2 RETURN EMP.SAL%TYPE
    3 IS
    4 V_NEWSAL EMP.SAL%TYPE;
    5 F_CONSTANT CONSTANT NUMBER :=1.05;
    6
    7 BEGIN
    8 V_NEWSAL := V_INCOMINGSAL * F_CONSTANT;
    9 RETURN V_NEWSAL;
    10
    11 END;
    12 /
    Function created.
    -- CODE BLOCK # 2----------------------------
    SQL>CREATE OR REPLACE PROCEDURE NEW_SALARY2
    2 IS
    3 V_SALFROMDBASE NUMBER;
    4 V_NEWVALFROMFUNC NUMBER;
    5
    6 BEGIN
    7 SELECT SAL
    8 INTO V_SALFROMDBASE
    9 FROM EMP
    10 WHERE EMPNO = 7839;
    11
    12 V_NEWVALFROMFUNC := COST_INCREASE_F(V_SALFROMDBASE);
    13
    14 DBMS_OUTPUT.PUT_LINE(V_SALFROMDBASE| |' '| |V_NEWVALFROMFUNC);
    15 END;
    16 /
    Procedure created.
    CODE BLOCK # 3---------------------------
    SQL>DECLARE
    2 V_SALFROMDBASE NUMBER;
    3 V_NEWVALFROMFUNC NUMBER;
    4
    5 BEGIN
    6 SELECT SAL
    7 INTO V_SALFROMDBASE
    8 FROM EMP
    9 WHERE EMPNO = 7839;
    10
    11 V_NEWVALFROMFUNC := COST_INCREASE_F(V_SALFROMDBASE);
    12
    13 DBMS_OUTPUT.PUT_LINE(V_SALFROMDBASE| |' '| |V_NEWVALFROMFUNC);
    14 END;
    15 /
    5000 5250
    PL/SQL procedure successfully completed.
    null

    Follow this steps to run the procedure.
    1. save the procedure in a folder in your hard disk as NEW_SALARY2.SQL.
    2. go to SQL*PLUS and then goto FILE->OPEN
    3. Then goto your folder where you have saved your procedure and then click once(only once) on the procedure name and then click cancel.
    4. Then type SQL>@NEW_SALARY2.SQL;
    it will execute your procedure.
    important: if you don't want to do that then
    type:
    SQL>exec c:\myfolder\NEW_SALARY2.sql
    it will execute your procedure.
    The same applies for your script.
    I hope this will help. If u still need help
    email me at [email protected]
    null

  • Schema as parameter in an stored procedure.

    Hi all!
    I would need to set the schemas I'll have to use in an stored procedure as a variable, this is:
    - I have this query: SELECT * FROM USER.TABLE_CUSTOMERS;
    - I'll have to set the schema with the parameter I have: SELECT * FROM s_user.TABLE_CUSTOMERS;
    - ...where s_user is an string and can have values like ADMIN, PREMIUMUSER, BASICUSER an so on, the schemas I have. But this doesn't runs so... there's any way to implement what I want to do? Hope you can understand my problem :)
    Thanks in advance!

    Thanks to both for the help :-) Now I think I'm near to the solution, but have some doubts an problems... lets see. I'll have this procedure in a general schema, because it will be executing every midnight in order to update a table in all the other schemas. I could just copy this procedure in each schema, but this is not a good solucion since a change in code means to change again the procedure in many schemas. So the idea is to have the procedure in a general schema, ok. Although a dynamic sql is not the best solution, I think is the only one for this, so I think I'll use...
    EXECUTE IMMEDIATE 'alter session set CURRENT_SCHEMA=' ||s_user;
    ..in my procedure. But now, modifying the code, something doesn't run well. Imagine I have this stupid code:
    CREATE OR REPLACE PROCEDURE Stupid_Procedure AS
    myVar NUMBER;
    BEGIN
    EXECUTE IMMEDIATE 'alter session set CURRENT_SCHEMA=mySchema';
    INSERT INTO acmeTable (acmeField) SELECT TO_CHAR(sysdate, 'MM') FROM dual;
    END Stupid_Procedure;
    Well, the acmeTable is a table in mySchema, but not in the current schema, but having set the CURRENT_SCHEMA to mySchema previously, there should not be any problem with the following query, should be? Well, yes, there's a problem because Oracle remarks this row and tells me... "table or view does not exist"
    What do you think I'm doing wrong?
    Thank you sincerely.

Maybe you are looking for

  • StorEDGEL9 on UE3000 with Solaris 2.5.1

    Can anyone tell me how to install StorEDGEL9 on UE3000 with Solaris 2.5.1 OS? It seems that this DLT tape drive cannot be detected by UE3000.

  • Installing 10g R2 on WinXP SP2 NL gives ORA-19870, ORA-19612, ORA-06512...

    I'm trying to install version 10g R2 on the following configuration: ASUS K8V SE board + AMD 64 Athlon + 512Mb Ram + 160GB SATA HD + 18GB IDE HD Windows XP SP2 NL When I install 10g without creating the db then it installs without problem. If I try t

  • Domain accounts in Windows 8.1

    I have a tablet with Windows 8.1 pre-installed.  I have joined the domain where I work and added a domain user account.  I assigned Administrator privileges to the account (with the control panel on the local machine), but I can't access some files.

  • TabNavigator: Adding Tab Dynamic

    Hi, I would like to create an application that is using a TabNavigator to show different information (tabs) when user press different buttons. I create a button and call a function to add a tab into tabnavigator to show a custom control (base on Pane

  • Generic icons for Office on desktop

    I copied the files on the desktop of my Air running 10.6.8 to a drive, and then copied those files to the desktop on my new Air running 10.10.2. The icons of all (and only) the Office files have gone generic. When I drag a Word file with the correct