Strange Behaviour in a stored Procedure

Hello forum
I am attempting to build an execute script as a part of a wider process.  essentially data is imported into a temporary table and then exported via bcp; so in order to capture the column headings I am using a cursor to build a string and then execute
it.  However, if I "PRINT" the script the script is correct, but if I "EXECUTE" either with EXECUTE or sp_executesql, the script is incorrect.
Here is the Code: -
Set
@ColNameScript =(Select
'Select ')
Set
@TotalCol =(Select
count
from syscolumns
where id
in
(select id
from sysobjects
where
name='voltemp'))
Set
@CurrentCol=1
Declare
Column_Curs Cursor
for
select
name
from syscolumns
where id
in
(select id
from sysobjects
where
name='voltemp')
Open
Column_Curs
Fetch
Next
From Column_Curs
Into @ColumnName
While
@@Fetch_Status=0
Begin
IF @CurrentCol<>
@TotalCol
BEGIN
Set @ColNameScript
=(Select @ColNameScript

'^'
+ @ColumnName
+'^'
+
' AS ['
+ @ColumnName
+
END
IF @CurrentCol=
@TotalCol
BEGIN
Set @ColNameScript
=(Select @ColNameScript

'^'
+ @ColumnName
+'^'

' AS ['
+ @ColumnName
+
'] INTO COLNAMETEMP')
END
Fetch
Next
From Column_Curs
Into @ColumnName
Set @CurrentCol=@CurrentCol+1
End
Close
Column_Curs
Deallocate
Column_Curs
SELECT
REPLACE
(@ColNameScript,
'^','''')
PRINT
@ColNameScript
EXECUTE
@ColNameScript;
If I comment out the EXECUTE command the script is printed as thus: -
Select
'territoryName'
AS [territoryName],'organisation'
AS [organisation],'displayname'
AS [displayname],'URN'
AS [URN],'vacancyid'
AS [vacancyid],'jobtitle'
AS [jobtitle],'Displayfrom'
AS [Displayfrom],'displayto'
AS [displayto],'date'
AS [date],'Advert/vacancytype'
AS [Advert/vacancytype],'Type(s)
of Work' AS [Type(s) of Work],'status'
AS [status],'PageViews'
AS [PageViews],'Total
Interaction' AS [Total Interaction],'Advert
Run' AS [Advert Run],'Job
Live Days' AS [Job Live Days],'Click
through rate' AS [Click through rate],'Days
to go' AS [Days to go],'Clicks
per day' AS [Clicks per day]
INTO COLNAMETEMP
If I include the EXECUTE command the script is printed as thus: -
Select
^territoryName^
AS [territoryName],^organisation^
AS [organisation],^displayname^
AS [displayname],^URN^
AS [URN],^vacancyid^
AS [vacancyid],^jobtitle^
AS [jobtitle],^Displayfrom^
AS [Displayfrom],^displayto^
AS [displayto],^date^
AS [date],^Advert/vacancytype^
AS [Advert/vacancytype],^Type(s)
of Work^
AS [Type(s) of Work],^status^
AS [status],^PageViews^
AS [PageViews],^Total
Interaction^
AS [Total Interaction],^Advert
Run^
AS [Advert Run],^Job
Live Days^
AS [Job Live Days],^Click
through rate^
AS [Click through rate],^Days
to go^
AS [Days to go],^Clicks
per day^
AS [Clicks per day]
INTO COLNAMETEMP
SQL Server version is 2005 Standard Edition SP4.
Please click "Mark As Answer" if my post helped. Tony C.

Your script is confusing, as is your description.  First the script.  At the end of the loop, you do 3 things.  You select the string, you print the string, and then you execute the string.  The first select statement will change the
contents of the string TEMPORARILY in the resultset, but it does not change the content of the string.  It seems that you should have updated the string to do this. 
Your execute attempt shouldn't work at all, since you need to enclose the string in parentheses.  So something isn't matching between the script and your discussion.  As an example:
set nocount on;
if object_id('COLNAMETEMP') is not null
drop table COLNAMETEMP;
go
DECLARE @script varchar(2000);
set @script = 'Select ^territoryName^ AS [territoryName],^organisation^ AS [organisation],^displayname^ AS [displayname],^URN^ AS [URN],^vacancyid^ AS [vacancyid],^jobtitle^ AS [jobtitle],^Displayfrom^ AS [Displayfrom],^displayto^ AS [displayto],^date^ AS [date],^Advert/vacancytype^ AS [Advert/vacancytype],^Type(s) of Work^ AS [Type(s) of Work],^status^ AS [status],^PageViews^ AS [PageViews],^Total Interaction^ AS [Total Interaction],^Advert Run^ AS [Advert Run],^Job Live Days^ AS [Job Live Days],^Click through rate^ AS [Click through rate],^Days to go^ AS [Days to go],^Clicks per day^ AS [Clicks per day] INTO COLNAMETEMP'
EXEC @script;
go
DECLARE @script varchar(2000);
set @script = 'Select ^territoryName^ AS [territoryName],^organisation^ AS [organisation],^displayname^ AS [displayname],^URN^ AS [URN],^vacancyid^ AS [vacancyid],^jobtitle^ AS [jobtitle],^Displayfrom^ AS [Displayfrom],^displayto^ AS [displayto],^date^ AS [date],^Advert/vacancytype^ AS [Advert/vacancytype],^Type(s) of Work^ AS [Type(s) of Work],^status^ AS [status],^PageViews^ AS [PageViews],^Total Interaction^ AS [Total Interaction],^Advert Run^ AS [Advert Run],^Job Live Days^ AS [Job Live Days],^Click through rate^ AS [Click through rate],^Days to go^ AS [Days to go],^Clicks per day^ AS [Clicks per day] INTO COLNAMETEMP'
set @script = REPLACE (@script, '^','''')
EXEC (@script);
select * from COLNAMETEMP;
go

Similar Messages

  • Strange error while executing a stored procedure: Incorrect syntax near '@p0'

    All, I am getting a strange error while executing a stored procedure: Incorrect syntax near '@p0'  using JDBC CallableStatment.
    Here is my code...
    CallableStatement cStmt = con.prepareCall("{call SET CHAINED ON EXEC <dbName>.<schemaName>.<SPName> (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)}");
    cStmt.setString(1, "2012005881");
    cStmt.setString(2, "07");
    cStmt.setString(3, "10");
    cStmt.setString(4, "Case title");
    cStmt.setString(5, "Open");
    java.sql.Date dt1 = new java.sql.Date(2014,10,20);
    cStmt.setDate(6, dt1);
    cStmt.setString(7, "01");
    cStmt.setString(8, "N");
    cStmt.setString(9, "ADA Test");
    cStmt.setString(10, "N");
    cStmt.setString(11, "English");
    cStmt.setString(12, "N");
    cStmt.setString(13, "N");
    cStmt.setString(14, "N");
    cStmt.setString(15, "N");
    cStmt.setString(16, "N");
    cStmt.setString(17, "N");
    cStmt.setString(18, "07");
    cStmt.setString(19, "10");
    cStmt.setString(20, "juache0");
    java.sql.Date dt2 = new java.sql.Date(2014,10,20);
    java.sql.Date dt3 = new java.sql.Date(2014,10,20);
    cStmt.setDate(21, dt2);
    cStmt.setDate(22, dt3);
    cStmt.setString(23, "userid0");
    cStmt.setString(24, "");
    cStmt.setString(25, "");  
    cStmt.setString(26, "");
    java.math.BigDecimal bg1 = new java.math.BigDecimal(10);
    cStmt.setBigDecimal(27, bg1);
    cStmt.setString(28, "userid");
    cStmt.setString(29, "userid");
    int hadResults = cStmt.executeUpdate();
    Your help is greatly appreciated.
    I am executing the above using Jconnect3.0 driver, inside WebSphere Application Server V8.0
    Thanks
    Nags

    NOTE: I don't work with JDBC/jConnect so (at this point) just some questions ...
    1 - are you sending this to ASE, ASA, IQ, or some other RDBMS?
    2 - what is the value of <schemaname>?
    3 - do you have other prepareCall() instances that successfully call a stored proc? [would be interesting to see if there's a difference in the format of the calls]
    A quick google search shows a couple ways to submit a stored proc execution to the RDBMS, with the format depending on the format expected by the target RDBMS.
    I'm wondering if you really need/want the parentheses around the argument list, ie, what happens if you change
    from
    -- parentheses around args
    EXEC <dbName>.<schemaName>.<SPName> ( ?,?,?,?,?,...,? )
    to
    -- no parentheses around args
    EXEC <dbName>.<schemaName>.<SPName> ?,?,?,?,?,...,?
    In ASE if I wrap the parameters in parentheses I get the same error you're getting:
    ================== w/ parentheses => error
    1> sp_who (sa)
    2> go
    Msg 102, Level 15, State 1:
    Server 'CC1_V1', Line 1:
    Incorrect syntax near 'sa'.   <<=== sa == @p0 ??
    ================== w/out parentheses => works
    1> sp_who sa
    2> go
    fid spid status  loginame origname ...
       0   17 running sa       sa       ...
    ==================

  • Can someone help me diagnose a strange stored procedure performance issue please?

    I have a stored procedure (posted below) that returns message recommendations based upon the Yammer Networks you have selected. If I choose one network this query takes less than one second. If I choose another this query takes 9 - 12 seconds.
    /****** Object: StoredProcedure [dbo].[MessageView_GetOutOfContextRecommendations_LargeSet] Script Date: 2/18/2015 3:10:35 PM ******/
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    CREATE PROCEDURE [dbo].[MessageView_GetOutOfContextRecommendations_LargeSet]
    -- Parameters
    @UserID int,
    @SourceMessageID int = 0
    AS
    BEGIN
    -- variable for @HomeNeworkUserID
    Declare @HomeNeworkUserID int
    -- Set the HomeNetworkID
    Set @HomeNeworkUserID = (Select HomeNetworkUserID From NetworkUser Where UserID = @UserID)
    -- SET NOCOUNT ON added to prevent extra result sets from
    -- interfering with SELECT statements.
    SET NOCOUNT ON
    -- Begin Select Statement
    Select Top 40 [CreatedDate],[FileDownloadUrl],[HasLinkOrAttachment],[ImagePreviewUrl],[LikesCount],[LinkFileName],[LinkType],[MessageID],[MessageSource],[MessageText],[MessageWebUrl],[NetworkID],[NetworkName],[PosterEmailAddress],[PosterFirstName],[PosterImageUrl],[PosterName],[PosterUserName],[PosterWebUrl],[RepliesCount],[Score],[SmallIconUrl],[Subjects],[SubjectsCount],[UserID]
    -- From View
    From [MessageView]
    -- Do Not Return Any Messages That Have Been Recommended To This User Already
    Where [MessageID] Not In (Select MessageID From MessageRecommendationHistory Where UserID = @UserID)
    -- Do Not Return Any Messages Created By This User
    And [UserID] != @UserID
    -- Do Not Return The MessageID
    And [MessageID] != @SourceMessageID
    -- Only return messages for the Networks the user has selected
    And [NetworkID] In (Select NetworkID From NetworkUser Where [HomeNetworkUserID] = @HomeNeworkUserID And [AllowRecommendations] = 1)
    -- Order By [MessageScore] and [MessageCreatedDate] in reverse order
    Order By [Score] desc, [CreatedDate] desc
    ENDThe Actual Execution Plan Shows up the same; there are more messages on the Network that is slow, 2800 versus 1,500 but the difference is ten times longer on the slow network.Is the fact I am doing a Top 40 what makes it slow? My first guess was to take the Order By Off and that didn't seem to make any difference.The execution plan is below, it takes 62% of the query to look up theIX_Message.Score which is the clustered index, so I thought this would be fast. Also the Clustered Index Seek for the User.UserID take 26%which seems high for what it is doing.
    I have indexes on every field that is queried on so I am kind of at a loss as to where to go next.
    It just seems strange because it is the same view being queried in both cases.
    I tried to run the SQL Server Tuning Wizard but it doesn't run on Azure SQL, and my problem doesn't occur on the data in my local database.
    Thanks for any guidance, I know a lot of the slowness is due to the lower tier Azure SQL we are using, many of the performance issues weren't noticed when were on the full SQL Server, but the other networks work extremely fast so it has to be something to
    with having more rows.
    In case you need the SQL for the View that I am querying it is:
    SET QUOTED_IDENTIFIER ON
    GO
    CREATE VIEW [dbo].[MessageView]
    AS
    SELECT M.UserID, M.MessageID, M.NetworkID, N.Name AS NetworkName, M.Subjects, M.SubjectsCount, M.RepliesCount, M.LikesCount, M.CreatedDate, M.MessageText, M.HasLinkOrAttachment, M.Score, M.WebUrl AS MessageWebUrl, U.UserName AS PosterUserName,
    U.Name AS PosterName, U.FirstName AS PosterFirstName, U.ImageUrl AS PosterImageUrl, U.EmailAddress AS PosterEmailAddress, U.WebUrl AS PosterWebUrl, M.MessageSource, M.ImagePreviewUrl, M.LinkFileName, M.FileDownloadUrl, M.LinkType, M.SmallIconUrl
    FROM dbo.Message AS M INNER JOIN
    dbo.Network AS N ON M.NetworkID = N.NetworkID INNER JOIN
    dbo.[User] AS U ON M.UserID = U.UserID
    GO
    The Network Table has an Index on Network ID, but it non clustered but I don't think that is the culprit.
    Corby

    I marked your response as answer because you gave me information I didn't have about the sort. I ended up rewriting the query to be a join instead of the In's and it improved dramatically, about one second on a very minimal Azure SQL database, and before
    it was 12 seconds on one network. We didn't notice the problem at all before we moved to Azure SQL, it was about one - three seconds at most.
    Here is the updated way that was much more efficient:
    CREATE PROCEDURE [dbo].[Procedure Name]
    -- Parameters
    @UserID int,
    @SourceMessageID int = 0
    AS
    BEGIN
    -- variable for @HomeNeworkUserID
    Declare @HomeNeworkUserID int
    -- Set the HomeNetworkID
    Set @HomeNeworkUserID = (Select HomeNetworkUserID From NetworkUser Where UserID = @UserID)
    -- SET NOCOUNT ON added to prevent extra result sets from
    -- interfering with SELECT statements.
    SET NOCOUNT ON
    ;With cteMessages As
    -- Begin Select Statement
    Select (Fields List)
    -- Join to Network Table
    From MessageView mv Inner Join NetworkUser nu on MV.NetworkID = nu.NetworKID -- Only Return Networks This User Has Selected
    Where nu.HomeNetworkUserID = @HomeNeworkUserID And AllowRecommendations = 1
    -- Do Not Return Any Messages Created By This User
    And mv.[UserID] != @UserID
    -- Do Not Return The MessageID
    And mv.[MessageID] != @SourceMessageID
    ), cteHistoryForThisUser As
    Select MessageID From MessageRecommendationHistory Where UserID = @UserID
    -- Begin Select Statement
    Select Top 40 (Fields List)
    -- Join to Network Table
    From cteMessages m Left Outer Join cteHistoryForThisUser h on m.MessageID = h.MessageID
    -- Do Not Return Any Items Where User Has Already been shown this Message
    Where h.MessageID Is Null
    -- An Order By Is Needed To Get The Best Content First
    Order By Score Desc
    END
    GO
    The Left Outer Join to test for null was the biggest improvement, but it also helped to join to the NetworkUser table instead of do the In sub query.

  • Strange download size of on calling packaged stored procedure in VB6

    Hi,
    I tried to use VB6 to call oracle stored procedure with ref cursor as output parameter under a package in 10g database (10.1.03). Oracle client uses windows 9.2 / 10.1.02 (Oracle OLEDB Provider) . I found that when the package size increases(> 1000 lines codes), the data size transfer from database to VB client also increases. I try to trap the binary data flow between VB6 and database when calling packaged stored procedure. I found that VB6(or oracle client ??) will first download package spec then execute the requested stored procedure. This may explain the cause of increasing size.
    However, this large download size for calling only one of the procedure will make my application run slowly when my application uses the package much. How can I solve this problem ? Does this relate to oracle client(p.s. this problem disappear when using Microsoft OLEDB Provider)?
    Thanks
    Steven

    You can use a wrapper to get compiled code and if it's 10g you can do even more by putting it in a library.
    OLEDB from VB6 still using Oracle 'Client' as you call Oracle NET.

  • Invoke stored procedure cause strange exception

    Hi, I'm using JDev 11.1.2, the use case is: add a new row to the VO iterator filtered by some view criteria and call a stored procedure before commit.
    The application runs fine without calling the stored procedure, however, following exception will occur if it's called.
    The stored procedure will do some update to a remote DB2 via DB link. Though the exception stack trace shows that the SP has error, but if I run it separately in some SQL tool, it is ok.
    The "BO_SP" problem seems not to be caused by the 'new row state'.
    Does any one have any tips for this problem? Thanks!
    <LifecycleImpl> <_handleException> ADF_FACES-60098:Faces lifecycle receives unhandled exceptions in phase INVOKE_APPLICATION 5
    oracle.jbo.DMLException: JBO-26041: Failed to post data to database during "Savepoint": SQL Statement "BO_SP".
         at oracle.jbo.server.DBTransactionImpl.setSavepoint(DBTransactionImpl.java:3184)
         at oracle.jbo.server.DBTransactionImpl.saveTmpPostState(DBTransactionImpl.java:1791)
         at oracle.jbo.server.DBTransactionImpl.commitInternal(DBTransactionImpl.java:2065)
         at oracle.jbo.server.DBTransactionImpl.commit(DBTransactionImpl.java:2352)
         at oracle.adf.model.bc4j.DCJboDataControl.commitTransaction(DCJboDataControl.java:1590)
         at oracle.adf.model.binding.DCDataControl.callCommitTransaction(DCDataControl.java:1415)
         at oracle.jbo.uicli.binding.JUCtrlActionBinding.doIt(JUCtrlActionBinding.java:1428)
         at oracle.adf.model.binding.DCDataControl.invokeOperation(DCDataControl.java:2169)
         at oracle.jbo.uicli.binding.JUCtrlActionBinding.invoke(JUCtrlActionBinding.java:731)
         at oracle.adf.controller.v2.lifecycle.PageLifecycleImpl.executeEvent(PageLifecycleImpl.java:402)
         at oracle.adfinternal.view.faces.model.binding.FacesCtrlActionBinding._execute(FacesCtrlActionBinding.java:252)
         at oracle.adfinternal.view.faces.model.binding.FacesCtrlActionBinding.execute(FacesCtrlActionBinding.java:210)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:597)
         at com.sun.el.parser.AstValue.invoke(Unknown Source)
         at com.sun.el.MethodExpressionImpl.invoke(Unknown Source)
         at oracle.adf.controller.internal.util.ELInterfaceImpl.invokeMethod(ELInterfaceImpl.java:173)
         at oracle.adfinternal.controller.activity.MethodCallActivityLogic.execute(MethodCallActivityLogic.java:163)
         at oracle.adfinternal.controller.engine.ControlFlowEngine.executeActivity(ControlFlowEngine.java:1035)
         at oracle.adfinternal.controller.engine.ControlFlowEngine.doRouting(ControlFlowEngine.java:926)
         at oracle.adfinternal.controller.engine.ControlFlowEngine.doRouting(ControlFlowEngine.java:824)
         at oracle.adfinternal.controller.engine.ControlFlowEngine.routeFromActivity(ControlFlowEngine.java:554)
         at oracle.adfinternal.controller.engine.ControlFlowEngine.performControlFlow(ControlFlowEngine.java:158)
         at oracle.adfinternal.controller.application.NavigationHandlerImpl.handleAdfcNavigation(NavigationHandlerImpl.java:115)
         at oracle.adfinternal.controller.application.NavigationHandlerImpl.handleNavigation(NavigationHandlerImpl.java:84)
         at org.apache.myfaces.trinidadinternal.application.NavigationHandlerImpl.handleNavigation(NavigationHandlerImpl.java:50)
         at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:130)
         at org.apache.myfaces.trinidad.component.UIXCommand.broadcast(UIXCommand.java:190)
         at oracle.adf.view.rich.component.fragment.UIXInclude.broadcast(UIXInclude.java:112)
         at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent$1.run(ContextSwitchingComponent.java:130)
         at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent._processPhase(ContextSwitchingComponent.java:461)
         at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent.broadcast(ContextSwitchingComponent.java:134)
         at oracle.adf.view.rich.component.fragment.UIXInclude.broadcast(UIXInclude.java:106)
         at oracle.adf.view.rich.component.fragment.UIXRegion.broadcast(UIXRegion.java:159)
         at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent$1.run(ContextSwitchingComponent.java:130)
         at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent._processPhase(ContextSwitchingComponent.java:461)
         at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent.broadcast(ContextSwitchingComponent.java:134)
         at oracle.adf.view.rich.component.fragment.UIXInclude.broadcast(UIXInclude.java:112)
         at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent$1.run(ContextSwitchingComponent.java:130)
         at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent._processPhase(ContextSwitchingComponent.java:461)
         at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent.broadcast(ContextSwitchingComponent.java:134)
         at oracle.adf.view.rich.component.fragment.UIXInclude.broadcast(UIXInclude.java:106)
         at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl.broadcastEvents(LifecycleImpl.java:1129)
         at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._executePhase(LifecycleImpl.java:353)
         at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:204)
         at javax.faces.webapp.FacesServlet.service(FacesServlet.java:312)
         at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
         at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
         at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:300)
         at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
         at oracle.adf.model.servlet.ADFBindingFilter.doFilter(ADFBindingFilter.java:173)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
         at oracle.adfinternal.view.faces.webapp.rich.RegistrationFilter.doFilter(RegistrationFilter.java:122)
         at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:468)
         at oracle.adfinternal.view.faces.activedata.AdsFilter.doFilter(AdsFilter.java:60)
         at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:468)
         at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl._doFilterImpl(TrinidadFilterImpl.java:293)
         at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl.doFilter(TrinidadFilterImpl.java:199)
         at org.apache.myfaces.trinidad.webapp.TrinidadFilter.doFilter(TrinidadFilter.java:92)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
         at oracle.security.jps.ee.http.JpsAbsFilter$1.run(JpsAbsFilter.java:111)
         at java.security.AccessController.doPrivileged(Native Method)
         at oracle.security.jps.util.JpsSubject.doAsPrivileged(JpsSubject.java:313)
         at oracle.security.jps.ee.util.JpsPlatformUtil.runJaasMode(JpsPlatformUtil.java:413)
         at oracle.security.jps.ee.http.JpsAbsFilter.runJaasMode(JpsAbsFilter.java:94)
         at oracle.security.jps.ee.http.JpsAbsFilter.doFilter(JpsAbsFilter.java:161)
         at oracle.security.jps.ee.http.JpsFilter.doFilter(JpsFilter.java:71)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
         at oracle.dms.servlet.DMSServletFilter.doFilter(DMSServletFilter.java:136)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
         at weblogic.servlet.internal.RequestEventsFilter.doFilter(RequestEventsFilter.java:27)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
         at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3715)
         at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3681)
         at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
         at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
         at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2277)
         at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2183)
         at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1454)
         at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)
         at weblogic.work.ExecuteThread.run(ExecuteThread.java:178)
    Caused by: java.sql.SQLException: ORA-28500: connection from ORACLE to a non-Oracle system returned this message:
    [Oracle][ODBC DB2 Wire Protocol driver][UDB DB2 for iSeries and AS/400]ILLEGAL SYMBOL <END-OF-STATEMENT>; VALID SYMBOLS ARE ON UNIQUE. {42000,NativeErr = -104}[Oracle][ODBC DB2 Wire Protocol driver][UDB DB2 for iSeries and AS/400]EXECUTE STATEMENT DOES NOT IDENTIFY A VALID PREPARED STATEMENT. *N {HY000,NativeErr = -518}
    ORA-02063: preceding 2 lines from TGBPSU
         at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:457)
         at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:405)
         at oracle.jdbc.driver.T4C8Oall.processError(T4C8Oall.java:889)
         at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:476)
         at oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:204)
         at oracle.jdbc.driver.T4C8Oall.doOALL(T4C8Oall.java:540)
         at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:217)
         at oracle.jdbc.driver.T4CPreparedStatement.executeForRows(T4CPreparedStatement.java:1079)
         at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1466)
         at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3752)
         at oracle.jdbc.driver.OraclePreparedStatement.execute(OraclePreparedStatement.java:3937)
         at oracle.jdbc.driver.OraclePreparedStatementWrapper.execute(OraclePreparedStatementWrapper.java:1535)
         at weblogic.jdbc.wrapper.PreparedStatement.execute(PreparedStatement.java:99)
         at oracle.jbo.server.OracleSQLBuilderImpl.setSavepoint(OracleSQLBuilderImpl.java:1548)
         at oracle.jbo.server.DBTransactionImpl.setSavepoint(DBTransactionImpl.java:3172)
         ... 83 more
    Edited by: codeplay on Oct 17, 2011 5:17 PM

    Look like the calling of the other DB is the root of your problem:
    Caused by: java.sql.SQLException: ORA-28500: connection from ORACLE to a non-Oracle system returned this message:[Oracle][ODBC DB2 Wire Protocol driver][UDB DB2 for iSeries and AS/400]ILLEGAL SYMBOL <END-OF-STATEMENT>; VALID SYMBOLS ARE ON UNIQUE. {42000,NativeErr = -104}[Oracle][ODBC DB2 Wire Protocol driver][UDB DB2 for iSeries and AS/400]EXECUTE STATEMENT DOES NOT IDENTIFY A VALID PREPARED STATEMENT. *N {HY000,NativeErr = -518}
    ORA-02063: preceding 2 lines from TGBPSU
    >
    Test your app with -Djbo.debugoutoup=console as a java option, this will generate lots of output but you may see the actual sql passed to the db.
    Where and how do you call the SP?
    Timo

  • Strange error on stored procedure after update to version 7.6.06.10

    Hi,
    in past version MaxDB 7.6.03 i created a stored procedure with follow SQL statement inside:
    TRY
                SELECT SUM(QTDE) QTDE_SAIDA
                   FROM VENDOR_CONCES.MVIEW_MOVPRODUTOS mviewS
                   WHERE mviewS.MY_EMPRESA = :OID_EMPRESA AND
                         mviewS.MY_PRODUTO_DEF = :OID_PRODUTO_DEF AND
                         mviewS.GERA_ESTOQUE = 'S' AND
                         mviewS.TIPO = 'S' AND
                         mviewS.DATA BETWEEN :MAX_DATA_ESTOQUE_INICIAL AND :DTA_ESTOQUE AND
                         EXISTS(SELECT * FROM VENDOR_CONCES.MVIEW_MOVPRODUTOS mviewE WHERE 
                            mviewE.my_Empresa = mviewS.my_Empresa AND
                            mviewE.tipo = 'E' AND
                            mviewE.data <= mviewS.data AND
                            mviewE.my_Produto = mviewS.my_Produto AND
                            mviewE.gera_Estoque = 'S' AND
                            mviewE.gera_Financeiro != 'N'
                FETCH INTO :QTDE_SAIDA;
            CATCH
                IF $rc <> 100 THEN STOP ($rc, 'unexpected error ao contar Saidas');
    if execute that procedure with new version 7.6.06.10 i get an error:
    (at 1834): Data types must be compatible.
    the line of error is this:
    mviewS.DATA BETWEEN :MAX_DATA_ESTOQUE_INICIAL AND :DTA_ESTOQUE AND
    if i remove the EXISTS part that procedure works, but i need to use EXISTS there.
    ps: MVIEW_MOVPRODUTOS is a table, not a view, i preceed tables with MVIEW for tables created by triggers, to simulate Materialized Views.
    ps2: DATA field is DATE field on english.
    any idea what can be wrong?
    best regards.
    Clóvis

    Hi, Elke
    you are right, changing SELECT * to SELECT oid works, follow the full procedure with changes:
    CREATE DBPROC SP_ESTOQUE_ATUAL_DATA_PROD_DEF (
        IN OID_EMPRESA VARCHAR(8),
        IN OID_PRODUTO_DEF VARCHAR(8),
        IN DTA_ESTOQUE TIMESTAMP,
        OUT ESTOQUE_ATUAL VARCHAR(200))
    AS
        VAR MAX_DATA_ESTOQUE_INICIAL TIMESTAMP;
            QTDE_ESTOQUE_INICIAL FIXED(10,3);
            QTDE_SAIDA FIXED(10,3);
            QTDE_ENTRADA FIXED(10,3);
        BEGIN
            TRY
                SELECT MAX(DATA) MAX_DATA_ESTOQUE_INICIAL
                   FROM VENDOR_CONCES.ESTOQUEINICIAL
                   WHERE MY_EMPRESA = :OID_EMPRESA AND
                       MY_PRODUTO = :OID_PRODUTO_DEF AND
                       DATA <= :DTA_ESTOQUE;
                FETCH INTO :MAX_DATA_ESTOQUE_INICIAL;
            CATCH
                IF $rc <> 100 THEN STOP ($rc, 'unexpected error em MAXDATAEINI');
            TRY
                IF MAX_DATA_ESTOQUE_INICIAL IS NULL THEN BEGIN
                    SET MAX_DATA_ESTOQUE_INICIAL = '1900-01-01 00:00:00.000';
                    SET QTDE_ESTOQUE_INICIAL = 0;
                END ELSE BEGIN
                    SELECT QTDE QTDE_ESTOQUE_INICIAL
                       FROM VENDOR_CONCES.ESTOQUEINICIAL
                       WHERE MY_EMPRESA = :OID_EMPRESA AND
                           MY_PRODUTO = :OID_PRODUTO_DEF AND
                           DATA BETWEEN :MAX_DATA_ESTOQUE_INICIAL AND :DTA_ESTOQUE;
                    FETCH INTO :QTDE_ESTOQUE_INICIAL;
                END;
            CATCH
                IF $rc <> 100 THEN STOP ($rc, 'unexpected error em Carregamento do Estoque Inicial');
            TRY
                SELECT SUM(QTDE) QTDE_SAIDA
                   FROM VENDOR_CONCES.MVIEW_MOVPRODUTOS mviewS
                   WHERE mviewS.MY_EMPRESA = :OID_EMPRESA AND
                         mviewS.MY_PRODUTO_DEF = :OID_PRODUTO_DEF AND
                         mviewS.GERA_ESTOQUE = 'S' AND
                         mviewS.TIPO = 'S' AND
                         mviewS.DATA BETWEEN :MAX_DATA_ESTOQUE_INICIAL AND :DTA_ESTOQUE AND
                         EXISTS(SELECT oid FROM VENDOR_CONCES.MVIEW_MOVPRODUTOS mviewE WHERE 
                            mviewE.my_Empresa = mviewS.my_Empresa AND
                            mviewE.tipo = 'E' AND
                            mviewE.data <= mviewS.data AND
                            mviewE.my_Produto = mviewS.my_Produto AND
                            mviewE.gera_Estoque = 'S' AND
                            mviewE.gera_Financeiro != 'N'
                FETCH INTO :QTDE_SAIDA;
            CATCH
                IF $rc <> 100 THEN STOP ($rc, 'unexpected error ao contar Saidas');
            TRY
                IF QTDE_SAIDA IS NULL THEN
                    SET QTDE_SAIDA = 0;
            CATCH
                IF $rc <> 100 THEN STOP ($rc, 'unexpected error ao zerar saida');
            TRY
                SELECT SUM(QTDE) QTDE_ENTRADA
                   FROM VENDOR_CONCES.MVIEW_MOVPRODUTOS
                   WHERE MY_EMPRESA = :OID_EMPRESA AND
                       MY_PRODUTO_DEF = :OID_PRODUTO_DEF AND
                       GERA_ESTOQUE = 'S' AND
                       TIPO = 'E' AND
                       DATA BETWEEN :MAX_DATA_ESTOQUE_INICIAL AND :DTA_ESTOQUE;
                FETCH INTO :QTDE_ENTRADA;
            CATCH
                IF $rc <> 100 THEN STOP ($rc, 'unexpected error ao contar entradas');
            TRY
                IF QTDE_ENTRADA IS NULL THEN
                    SET QTDE_ENTRADA = 0;
            CATCH
                IF $rc <> 100 THEN STOP ($rc, 'unexpected error ao zera entrada');
            TRY
                SET ESTOQUE_ATUAL = CHR(QTDE_ESTOQUE_INICIAL + QTDE_ENTRADA - QTDE_SAIDA);
            CATCH
                IF $rc <> 100 THEN STOP ($rc, 'unexpected error');
        END;
    about the error, I discovered the line using database studio, as I droped the old procedure and tried to recreate, database studio says that error is at BETWEEN expression, but you find the right problem with select * in exists.
    best regards
    Clóvis

  • Weird behaviour with Variables of a Stored Procedure

    Hello All,
       I'm writing following stored procedure and it is failing with following error
    "Conversion failed when converting from a character string to uniqueidentifier"
     What's Happening?
      I've created
    Create Procedure usp_Sample
    AS
    Declare @Var Int
    Select @Var = Key From MyKeyTable Where Name = 'XYZ'
    Select * From BaseTable A
    LEFT JOIN JoinTable B
    ON A.UniqueIdentifierField = CONVERT(UNIQUEIDENTIFIER,B.VarcharField)
    AND B.Key = @Var
    GO
    Procedure got created and when you execute it you see the above error...
    If I remove the Variable and HardCode it with any value then it runs fine...
    Could someone tell me what is wrong with the variable here? (I Can't hardcode the Variable Value In the Proc).
    "BaseTable" has a field that is UniqueIdentifier and "JoinTable" has a NVARCHAR (1020) Field. But JoinTable has proper UniqueIdentifier data. 
    Let me know if you need anymore info...
    --Roger
    Unknown

    Could someone tell me what is wrong with the variable here? (I Can't hardcode the Variable Value In the Proc).
    You are making the mistake to assume that just because is no error message, nothing is wrong.
    Apparently there are values in the varchar column which are not GUIDs, so saying
       CONVERT(UNIQUEIDENTIFIER,B.VarcharField)
    is an accident waiting to happen. But it does not have to blow up, just like you don't have to crash when you drive on the wrong side of the road. If you are lucky, there are no cars there in that moment.
    There is no defined order in which operands are evaluated in SQL Server, and using a variable or a constant is very likely to give you diffeent query plan.
    If you are on SQL 2012, use try_convert instead which will return NULL if the value does not convert. But Naomi is probably right when she suggest that you should convert the GUID to string, given the structure of the query.
    Erland Sommarskog, SQL Server MVP, [email protected]

  • APEX fails with Java stored procedure that creates a JDBC connection

    Hello!
    We are facing a strange problem since we have upgraded from Oracle 10g and Apache to Oracle 11g with Embedded Gateway.
    Here is what we do:
    ** APEXX calls a PL/SQL package function "OPEN_CONNECTION" that wraps a Java stored procedure called "openConnection".*
    FILE_READER_REMOTE_API.openConnection(user, password, host, port, service);
    ** The Java stored procedures "openConnection" opens a JDBC connection to an other database:*
    public class FileReaderRemote {
    private static Connection conn = null;
    private static DefaultContext remoteContext = null;
    public static void openConnection(String user, String password, String host, String port, String service) throws SQLException {
    // Load the Oracle JDBC driver
    DriverManager.registerDriver(new oracle.jdbc.OracleDriver());
    java.util.Properties props = new java.util.Properties();
    props.put ("user", user);
    props.put ("password", password);
    //props.put ("database", "//" + host + ":" + port + "/" + service);
    props.put ("database", host + ":" + port + ":" + service);
    props.put("v$session.program", "FileReaderRemote2");
    // Connect to the database
    remoteContext = Oracle.getConnection("jdbc:oracle:thin:", props);
    This procedure used to work fine before the upgrade, but now we see the following:
    * It still works when called directly from TOAD or SQL*Plus, even under the user ANONYMOUS.
    * When called from APEX and the target database is Oracle 11g, it still works.
    * When called from APEX and the target database is Oracle 10g, it takes several minutes and we receive this error:
    *"Socket read timed out"*
    We have tested the following workaround:
    We have created a database link to our own database and called the stored procedure through that database link.
    FILE_READER_REMOTE_API.openConnection*@loopback*(user, password, host, port, service);
    This works, but is not really an option.
    I hope some one of you can explain this strange behaviour to me.
    Best regards,
    Matthias

    You wrote
    "Java stored procedures -- by definition - are stored in the 8i rdbms. !!"
    From the Oracle8i Java Stored Procedures Developer's Guide
    Release 8.1.5
    A64686-01
    "If you create Java class files on the client side, you can use loadjava to upload them into the RDBMS. Alternatively, you can upload Java source files and let the Aurora JVM compile them. In most cases, it is best to compile and debug programs on the client side, then upload the class files for final testing within the RDBMS"
    This means that you can create shared classes that are used on both the client and server side. The source does not need to reside within the server (according to their documentation). Please also note the following from the Oracle8i JDBC Developer's Guide and Reference Release 8.1.5 A64685-01 for using the getConnection() method on the server:
    "If you connect to the database with the DriverManager.getConnection() method, then use the connect string jdbc:oracle:kprb:. For example:
    DriverManager.getConnection("jdbc:oracle:kprb:");
    Note that you could include a user name and password in the string, but because you are connecting from the server, they would be ignored."
    So if you're coding a shared class that is to run on both the client and server side, you might do something like this:
    Connection conn =
    DriverManager.getConnection(
    System.getProperty("oracle.server.version") == null
    ? "jdbc:oracle:thin:@hostname:1521:ORCL"
    : "jdbc:oracle:kprb:"),
    "youruserid","yourpassword");
    As stated earlier, the userid and password are supposedly ignored for server connections retrieved in this manner. I haven't tried this yet, but it is documented by Oracle.
    Regards,
    Steve
    null

  • Calling db2 stored procedures from wls 8.1 sp2

    Hi,
    We noticed strange behaviour when moving customers applications from wls 6.1 to 8.1 sp2. We have a use case where we call db2 stored procedure two times (same prcedure) to make inserts to a database. The first time when procedure is called, everything goes smoothly but at the second time db2 claims that statement is not prepared and gives us sql error sql0518n.
    We do see this error only if we use wls prepared statement cache and without cache (size=0) everything seems to work. We also did some db2 level tracing and noticed that statement is not prepared when using wls cache and db2 cannot execute statement which is not prepared....
    Why I'm asking this? because this is the first time I had disable wls cache. We have used it and even optimized software performance using prepared statement cache in several projects before this.
    Procedure call is done from web container lavel and no EJBs is used. We have tested the use case using autommit option and also committed firts transaction manually and closed connection.
    We are using DB2 8.2 fp7 as a database and IBM level 2 JDBC driver without XA support. Honor global transactions support is on at a datasource.
    Is this normal behaviour? Db2 problem or maybe WLS problem?
    Regards,
    Mika

    I am getting the same exception about an assertion failed at weblogic.t3.srvr.T3Srvr.checkServerLock. Any ideas?

  • Regional settings influences jdbc stored procedure calls?

    Hi,
    We have a strange problem: we use a jdbc test client
    that does a simple stored procedure call with one
    input parameter (integer) and one output parameter
    (integer). Like:
    "? = callprocedure(?)" . The database resides on a different server.
    The problem is: this only works when we use "netherlands" regional setting on the windows 2000 machine that
    java client program runs on. If we switch to
    "english (united states)" the call gives other results
    in the output parameter / returns an error code.
    Does this have something to do with the Locale of the
    virtual machine? Or do I have to do something with
    NLS_LANG to eliminate the behaviour that is dependent on
    the windows regional settings? Please help!
    Thanks,
    Michel Schudel
    We use the Oracle JDBC thin driver, latest version.
    (archive: classes12.zip)

    Ok, here it is. Basically, I first call a stored procedure called SETPARAM which receives two Strings:
    a parameter name and a a parameter value. After that, I
    call a procedure called RUNSQLKIT without any input parameters. The output parameter is an integer that indicates the number of "cells" in the output message. After that, I start to retrieve the cells but that is not important here. What happens is: with Dutch regional settings, the number of cells is normal (387) but with
    US settings, the number of cells is -1 (indicates an error.) Why? I use no dates or floating point values as
    input/output!
    Jvm version is 1.3.1_08, oracle driver is 8.1.7
    (Oracle 8i) thin jdbc driver. Oracle runs on AIX.
    conn = m_dataSource.getConnection();
    // Setup the input params
    stmtInput = conn.prepareCall("BEGIN Pck_Sqlmast.setparam(?,?); END;");
    for (final Iterator iter = m_kitParameterNames.iterator(); iter.hasNext();) {
    final String sName = (String) iter.next();
    final String sValue = input.getParameter(sName);
    if (sValue != null) {
    stmtInput.setString(1, sName);
    stmtInput.setString(2, sValue);
    stmtInput.executeUpdate();
    // Call the kit
    stmtRun = conn.prepareCall("BEGIN ? := Pck_Sqlmast.runsqlkit(?); END;");
    stmtRun.registerOutParameter(1, Types.INTEGER);
    stmtRun.setString(2, m_kitName);
    stmtRun.executeUpdate();
    final int iCells = stmtRun.getInt(1);
    Hi Michel,
    Perhaps you would care to post some more information
    including:
    1. Entire error message and stack trace you are
    getting.
    2. The part of your java code where the error
    occurs.
    3. Java version you are using.
    4. Oracle database version you are using.
    5. Platform on which Oracle database is running.
    Good Luck,
    Avi.

  • PL\SQL Stored Procedure failing.

    Hi,
    I have a collection of stored PL\SQL procedures in an Oracle 8i database. I call these stored procedures from Java code through OracleCallableStatement.
    I am experiencing a very strange problem. The system will run fine for a number of hours/days, during which time there will be many hundreds of successful calls to the stored procedures through the JDBC.
    Then, seemingly at random a call will fail. The error originates in the stored procedure and is reported as TABLE OR VIEW DOES NOT EXIST. I must stress here that a procedure that has run successfully many times before, will suddenly fail with this error.
    To my knowledge the stored procedures and schema have not been altered at all. Recompiling the PL\SQL procedure solves the problem.
    Could someone please help me to understand this strange behaviour.
    Thanks in advance,
    Max
    Oracle 8.1.7
    Java 1.3.1
    Classes12.zip

    Hi Max,
    If the error you are receiving is "TABLE OR VIEW DOES NOT EXIST", then you are indeed trying to access a non-existent table. Either the table has been "dropped" or you are using the wrong name to access it. Is the table a temporary table? Are you dynamically generating the name of the table in your java (or PL/SQL) code? When the error occurs, are you verifying whether the table does exist (or not)? Are there any background processes running (like backups, or statistics gathering) that may interfere with your stored procedures? Are these stored procedures in (PL/SQL) packages (that rely on "global" variables that suddenly have their values changed)?
    Solving the problem is easy. Finding the cause of the problem is hard. The error message can sometimes be misleading.
    Good Luck,
    Avi.

  • Semaphores on SQL-database: stored procedure mc_chk_sema_timeout

    Hi there!
    We do run this environment:
    Microsoft Server 2008 R2
    Microsoft SQL server /2008 R2 / driver 10.50.4000
    Identity-Management 7.2, SP6 Patch 1
    We`re discovered a (strange?) behavior in our SQL-database cache.
    As we look to the top most executions per minute,the IdM stored procedure "mx_chk_sema_timeout" gets the highscore (is the number one procedure that hast most cpu, time, reads, and so on)... It is executed 161 (in average) per minute.
    This is executed this often:
    USE [db]
    GO
    /****** Object:  StoredProcedure [dbo].[mc_chk_sema_timeout]    Script Date: 13.01.2015 13:37:24 ******/
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER OFF
    GO
    CREATE PROCEDURE [dbo].[mc_chk_sema_timeout]
           @Ptimeout int,
           @Status as int OUTPUT,
           @Statustext as varchar(256) OUTPUT
    AS
           Declare @Lrowcount int
           Declare @Lbuf varchar(256)
           -- LOCK
           EXEC sp_getapplock 'mc_chk_sema_timeout','Exclusive','session'
           delete from mc_semaphore where (DATEADD(s, @Ptimeout, Sematime)<getdate());
           select @Status = @@ERROR, @Lrowcount = @@ROWCOUNT
           -- UNLOCK
           EXEC sp_releaseapplock 'mc_chk_sema_timeout','session'
           IF @Status = 0
           BEGIN
                 set @Statustext = 'OK'
                 IF @Lrowcount > 0
                 BEGIN
                        set @Lbuf = convert(varchar,@Lrowcount) + ' stale semaphores released'
                        execute mc_write_syslog @Lbuf,'',1,'',0
                 END
           END
           ELSE
           BEGIN
                 set @Statustext = 'Unable to release staled semaphore';
           END
    GO
    My questions:
    1. Is this maybe a normal behavior (seen on DB time and execution) and we should not be worried?
    If not, what can we do to lower the executions per minute?
    I did some searchs:
    The table mc_semaphore shows no special behavior. Looks good for me: Some (1-6 semaphore go in, 1-6 leave immediately). I had expected, that this table would maybe be overflowed. But it wasnt...
    I also  read this SCN entry of Per Krabsetsve (at the end of the entry): Dispatchers Deadlock Issue
    He talks (in case of a about contacting the SAP-Support in order to get a different (altered?)  procedure of "mc_chk_sema_timeout".
    2. Maybe this would be a solution?
    3. Are there any further suggestions/experiences you can give us?
    Thank you for your replies!
    Michael

    If I recall correctly... The check sema timeout is called by the dispatcher(s) every check interval, so if you have 2 dispatchers checking every 5 seconds you'll have about 24 checks a minute. Which makes little sense considering the timeout is 300 seconds.
    The updated procedures that you refer to changes the behaviour of the semaphore handling from deleting the rows to just continously updating them with dispatcherId/timestamps. This was part of a patch or SP at some point. This reduces the number of locks used in the semaphor handling procedures and the size of the transactions. I believe there was also added a check to see if there were any expired semaphores first before running the delete, which also helps the system a bit. Not sure if those updated procedures are handed out any longer, but you should check.
    Br,
    Chris

  • Java stored procedure vs. PL-SQL vs. external java program

    Hi,
    I'm using a stored procedure for running a query and a few consequent updates. Currently I'm using Java stored procedure for that, which was my choice for simplicity on one hand, and running with the DB on the other.
    In my tests, strangely enough it came out that running as java stored procedure was 3-4 times slower than running as a java program outside the database. I don't know how to explain this, and I wonder if switching to PL/SQL will improve the performance of the code.
    Any experiences? recommendations?
    Thanks,
    Dawg

    In my tests, strangely enough it came out that running as java stored procedure was 3-4 times slower than running as a java program outside the database. I don't know how to explain this, and I wonder if switching to PL/SQL will improve the performance of the code.This isn't strange at all. See: Oracle's JVM (Aurora) is an independent Java Virtual Machine implementation, in accordance to specification. It implements all necessary parts of it (I think so). When you use an external JVM (I assume it's Sun's HotSpot JVM) you use completely different product. It is implemented in different way, it has many different code parts.
    One of the biggest differences between Oracle's JVM and Sun's JVM is [Just-in-Time compiler|http://en.wikipedia.org/wiki/Just-in-time_compilation]. Oracle has implemented it only in the 11g version of database, i.e. 2 years ago, while Sun performed it back in 2000 and continues to improve it for the last 9 years. That would explain obvious differences between Java program inside and outside the DB: they are executed in absolutely different worlds. Diffs could be up to 10x times or more - that's not unusual.
    If you are on 10g and want to compare performance of stored Java procedure vs external program, then you might use additional command-line instruction for external program to disable JIT:
    -XintPS. I wouldn't use Java for your task - that's a total overkill. Use simple SP instead.

  • APEX Listener and EPG - strange behaviour

    Hi
    For some years, I've used EPG for APEX but have struggled with performance particularly as I can have up to 150 student developers using at any one time.
    I do a fair amount of work using ORDImage and have successfully developed APEX applications to upload image files and display full-size and thumbnail images.
    After upgrading to APEX 4.1 (from 4.0), I decided to install APEX Listener standalone.
    Before I did so I checked that my applications still worked in 4.1 and they did.
    However, just installing APEX Listener but not configuring it (yet) has meant that my image display in a report using a procedure based on wpg_docload.download_file( l_ordimage_image.source.localData ) no longer works in EPG - the images are not displayed.
    Configuring APEX Listener and running the same application through that DOES display the images.
    So this part of the application works under APEX Listener but not under EPG.
    My application also allows users to upload images from APEX_APPLICATION_FILES using standard code. Under APEX Listener after uploading, I'm left with a blank page with a wwv_flow.accept URL although the image does indeed upload. Under EPG it works as expected and I get a success confirmation.
    So this part of the application works under EPG but not under APEX Listener.
    Has anyone else come across different behaviour depending on the mode of connection?
    Thanks
    Brian
    [Oracle EE 11gR2, Windows Server 2008R2, APEX 4.1, APEX Listener 1.1.3]

    Hi Brian,
    it sounds like you have both EPG and APEX Listener running on the same machine, so your problem might result from a port conflict. Note that both services use TCP port 8080 as default.
    At least a port conflict would explain the strange behaviour in your case, some things working on one web server and some on the other.
    Some parts of your initial post hint to that direction, e.g.
    However, just installing APEX Listener but not configuring it (yet) has meant that my image display in a report using a procedure based on >wpg_docload.download_file( l_ordimage_image.source.localData ) no longer works in EPG - the images are not displayed.... because the APEX Listener only interfere with the EPG if it is at least running on the same machine as your database and furthermore, if it is unconfigured in terms of ist database connection, a port conflict might be the only way it could cause anything like that.
    However, if you are sure that's not the issue, please check if you see any error in the APEX Listener's log for the following action you performed:
    My application also allows users to upload images from APEX_APPLICATION_FILES using standard code. Under APEX Listener after uploading, I'm left with a blank >page with a wwv_flow.accept URL although the image does indeed uploadIf you actually see just a blank screen, something very bad must have happened and you should see some kind of stack trace there.
    For further investigations, if necessary, it would be helpful to know how you deployed or started your APEX Listener and which JDK version you use.
    For the moment, I still think the port conflict is my best guess.
    You could avoid it by either changing the port for EPG (I'd not recommend that if you have other users still using it) or by changing the port for your APEX Listener.
    -Udo

  • View Master mode strange behaviour with jpg files

    Hy all,
    I'm using Aperture, and I'm tweakin a lot the SW to discover all secrets ....
    I'm really concerned about a strange behaviour of the SW in view mode.
    If I open a jpg file, do not apply ANY modification, and apply the "show master" command (pressing M), there's a subtle behaviour :
    *the images get sharper !!!!*
    It behaves as if an "edge sharpening" was applied !!!!!!
    With _RAW files this thing doesn't happen at all._
    Even stranger, if I zoom to full definition (by pressing Z), and toggle between normal view and "show master" view, the immage remains the same !
    The effect is not so evident with all images, but sometimes it is !!
    Anyway, I expect not to have such kind of things with a professional SW.
    With professional cameras and good quality files it's really annoying not to beeing sure what's the REAL content of the jpg image.
    Has anyone noted this thing ? Is there a reasonable explanation ?
    The only one I tried to figure out is the following : may be Aperture applies some kind of resampling algorithm with jpg files (bicubic, bilinear, etc).
    May be this resampling is not applied with 100% magnification, as weel as with raw files.
    But it's only my guessing. Now, I'm tweaking other viewers and other SW to understand what's the real jpg image stored in the file : the blurer one form normal view or the sharper one with "show master" mode.
    I stress once again : of course, the jpg file I'm talking about have no settings at all, just imported and toggled with M button.
    Thanks in advance.
    Regards,
    Enzo

    Hy,
    I'm afraid I'm not been clear.
    The problem is this :
    1) jpg image opened in normal view mode, no zoom, (no quick preview, of course) : image with a certain amount of blour
    2) jpg image opened in show master mode, no zoom, (no quick previre, of course) : image SHARPER with respect with the previous.
    No edit applied from import, so "show master" command shouln't apply any change in rendering, should it ?
    The only thing I said on 100% view is that such difference (between normal mode e show mastermode) is not present with 100% magnification.
    That was the issue.
    Enzo

Maybe you are looking for

  • Cd/dvd drive has disappeared

    my cd/dvd drive is not detected by windows, but is detected by the device manager the BIOS detects is as well. I've tried removing the upper & lower filters, uninstalling and reinstalling the drivers, and have also checked to see if I can assign the

  • How do I get an app I downloaded on my ipad to my macbook pro

    I downloaded and purchased an app onto my ipad and I can't seem to get it downloaded on my macbook pro can anyone help

  • TOC indenting a heading that shouldn't be indented

    Hi, Gang! I've created a TOC for a book and the TOC entries for the two divider pages are indenting when they should not be. The TOC style for the divider page heading has no indentation and the entry on the TOC reference page looks correct. To make

  • Plant Maintenance - Deleting installed base

    Plant Maintenance - Deleting installed base I have set up deletion flag in an installed base and trying to create a new one with the same material and serial number. But system given error saying that already exists. Pls advise.

  • Flash video can not be loaded

    Using Captivate 6, when I make any changes to an already published project that contains flash video, upon republishing I get a pop up stating "The flash video can not be loaded. The output may not be proper."  It only happens when I make a change to