For a hidden field, I am attempting to 'weld' the Account_ID of the currently logged in user, to an Account_ID field. Taking into account the uppercase situation with Oracle, I am attempting to use the following code:
ACCOUNT_.ACCOUNT_ID in (Select ACCOUNT_ID from URO_PP_ACCOUNTS where USERNAME = '{Context.User.Identity.Name}')
(the command references this table with an ACCOUNT_ prefix)
Testing this in Oracle SQL Developer with 'admin' instead of {Context.User.Identity.Name}, it doesn't return errors - but when I try to generate and run this, I am getting the following error.
What syntax should I use for this (or is it even possible?)
Component: ctl00_PageContentPlaceHolder_view1Extender
Controller: URO_PP_MESSAGES; View: grid1; Timed out: false
Exception: Oracle.DataAccess.Client.OracleException
Message: ORA-00907: missing right parenthesis
Stack:
at Oracle.DataAccess.Client.OracleException.HandleErrorHelper(Int32 errCode, OracleConnection conn, IntPtr opsErrCtx, OpoSqlValCtx* pOpoSqlValCtx, Object src, String procedure, Boolean bCheck)
at Oracle.DataAccess.Client.OracleException.HandleError(Int32 errCode, OracleConnection conn, String procedure, IntPtr opsErrCtx, OpoSqlValCtx* pOpoSqlValCtx, Object src, Boolean bCheck)
at Oracle.DataAccess.Client.OracleCommand.ExecuteReader(Boolean requery, Boolean fillRequest, CommandBehavior behavior)
at Oracle.DataAccess.Client.OracleCommand.ExecuteDbDataReader(CommandBehavior behavior)
at System.Data.Common.DbCommand.ExecuteReader()
at OSP.Data.TransactionManager.ExecuteReader(PageRequest request, ViewPage page, DbCommand command)
at OSP.Data.DataControllerBase.OSP.Data.IDataController.GetPage(String controller, String view, PageRequest request)
at OSP.Services.DataControllerService.GetPage(String controller, String view, PageRequest request)
Proper Syntax for an Oracle SQL Expression, passing in User.Identity.Name
-
The correct syntax is
. . .USERNAME = :BusinessRules_UserName . . .
-
-
I am still getting a 'missing right parenthesis' error, using this code:
ACCOUNT_.ACCOUNT_ID in (Select ACCOUNT_ID from URO_PP_ACCOUNTS where USERNAME = :BusinessRules UserName)
I also tried this
ACCOUNT_.ACCOUNT_ID in (Select ACCOUNT_ID from URO_PP_ACCOUNTS where USERNAME = :BusinessRules USERNAME)
I am afraid I am not implementing your suggestion correctly here... -
-
Unfortunately the sample block above hides the "underscore".
Use:
:BusinessRules_UserName -
-
Please reference the following tutorial http://codeontime.com/learn/security/....
Note that SQL Server and MySQL programmers are using "@" as a parameter marker.
Oracle developers shall use ":" instead. -
-
Well... maybe I am getting a little closer. My business rule script ended up looking like this, after I worked through that tutorial:
UPDATE URO_PP_MESSAGES SET ACCOUNT_ID = (SELECT ACCOUNT_ID FROM URO_PP_ACCOUNTS WHERE USERNAME = :BusinessRoles_UserName) WHERE MESSAGE_ID = :MESSAGE_ID
The error I am getting is 'Not all variables bound'... Do you see anything painfully obvious I am missing here? -
-
-
-
Well... the example on that page referenced @OrderID to keep the update from affecting all rows:
update Orders
set ModifiedByUserID = @BusinessRules_UserId,
ModifiedByUserName = @BusinessRules_UserName
where OrderID = @OrderID
So I assumed a similar process would be needed for my query...-
Forgot to add - it's the primary key / identity column of the URO_PP_MESSAGES table, just like OrderID would be for the Orders table.
-
-
-
-
-
bugger, I wrote BusinessRoles, not BusinessRules. It's not throwing an error, but it's not updating the record with the correct information either... but maybe that's because I chose 'After' instead of 'Before'....
-
What authentication method are you using?
The method affects what is returned by UserId and UserName. -
-
-
-
-
Well, I've learned some really valuable things today about COT.... I was able to add this to the Code Default for the field, and it returns what I need:
SqlText.ExecuteScalar("SELECT ACCOUNT_ID FROM URO_PP_ACCOUNTS WHERE USERNAME= :UserName", Context.User.Identity.Name)
With COT I am learning there's about 23,234 ways to skin the cat... -
Loading Profile...



Twitter,
Facebook, or email.

EMPLOYEE
