With Store procedure Error
Hi all I face a error in create store procedure with like this code can u tel me what i did wrong .
here is my code
Create PROCEDURE [dbo].[FACT_CURRENT_VS_PRV]
@country nvarchar (50)
AS
BEGIN
if @command='XPO1'
BEGIN
WITH CurrentMonth(
SHORT_DESC ,
PERIOD_CODE,
SALES_VALUE_01 Units,
SALES_VALUE_02 [Values]
as (
SELECT
SHORT_DESC ,
PERIOD_CODE,
SALES_VALUE_01 Units,
SALES_VALUE_02 [Values]
FROM table 3
PreviousMonth(
SHORT_DESC,
PERIOD_CODE,
SPEC_CODE_IMS,
SPEC_CODE_PFZ,
Units,
[Values]
as (
SELECT
SHORT_DESC ,
PERIOD_CODE,
SALES_VALUE_01 Units,
SALES_VALUE_02 [Values]
FROM table 4
SELECT * FROM CurrentMonth
except
END
If @country='XPO2'
BEGIN
WITH CurrentMonth(
SHORT_DESC,
PERIOD_CODE,
SPEC_CODE_IMS,
SPEC_CODE_PFZ,
Units,
[Values]
as (
SELECT
SHORT_DESC ,
PERIOD_CODE,
SALES_VALUE_01 Units,
SALES_VALUE_02 [Values]
FROM table 1
PreviousMonth(
SHORT_DESC ,
PERIOD_CODE,
SALES_VALUE_01 Units,
SALES_VALUE_02 [Values]
as (
SELECT
SHORT_DESC ,
PERIOD_CODE,
SALES_VALUE_01 Units,
SALES_VALUE_02 [Values]
FROM table 2
SELECT * FROM CurrentMonth
except
select * FROM PreviousMonth
END
END
and i got this error
Msg 319, Level 15, State 1, Procedure FACT_CURRENT_VS_PRV, Line 116
Incorrect syntax near the keyword 'with'. If this statement is a common table expression, an xmlnamespaces clause or a change tracking context clause, the previous statement must be terminated with a semicolon.
Msg 102, Level 15, State 1, Procedure FACT_CURRENT_VS_PRV, Line 152
Incorrect syntax near ','.
I m little bit confused why its happen
Thanks for help
The error message is obvious. each CTE has to be preceded by ;
so use like this
Create PROCEDURE [dbo].[FACT_CURRENT_VS_PRV]
@country nvarchar (50)
AS
BEGIN
if @command='XPO1'
BEGIN
;WITH CurrentMonth(
SHORT_DESC ,
PERIOD_CODE,
SALES_VALUE_01 Units,
SALES_VALUE_02 [Values]
as (
SELECT
SHORT_DESC ,
PERIOD_CODE,
SALES_VALUE_01 Units,
SALES_VALUE_02 [Values]
FROM table 3
PreviousMonth(
SHORT_DESC,
PERIOD_CODE,
SPEC_CODE_IMS,
SPEC_CODE_PFZ,
Units,
[Values]
as (
SELECT
SHORT_DESC ,
PERIOD_CODE,
SALES_VALUE_01 Units,
SALES_VALUE_02 [Values]
FROM table 4
SELECT * FROM CurrentMonth
except <you're missing something here>
END
If @country='XPO2'
BEGIN
;WITH CurrentMonth(
SHORT_DESC,
PERIOD_CODE,
SPEC_CODE_IMS,
SPEC_CODE_PFZ,
Units,
[Values]
as (
SELECT
SHORT_DESC ,
PERIOD_CODE,
SALES_VALUE_01 Units,
SALES_VALUE_02 [Values]
FROM table 1
PreviousMonth(
SHORT_DESC ,
PERIOD_CODE,
SALES_VALUE_01 Units,
SALES_VALUE_02 [Values]
as (
SELECT
SHORT_DESC ,
PERIOD_CODE,
SALES_VALUE_01 Units,
SALES_VALUE_02 [Values]
FROM table 2
SELECT * FROM CurrentMonth
except
select * FROM PreviousMonth
END
END
I think you're missing a statement after except in first condition
Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs
Similar Messages
-
Error when run crystal report with store procedure in JSP
I try to run report which is developed by crystal report XI and store procedure (SQL 2005) with JSP.
But it occurs error that is "com.crystaldecisions.reports.reportengineinterface.JPEReportSource - failed to process getPage request: No results were returned by the query."
How can I do for solving this problem? Pls, help me !!!!!
(In other report which is not used store procedure I can run fine.)
Message was edited by:
Bonds_IdentityWhat version of CR are you using?
What CR updates are you using?
See sample apps here:
https://wiki.sdn.sap.com/wiki/display/BOBJ/CrystalReportsfor.NETSDK+Samples
in particular check out vbnet_win_pass_dataset_main_sub.zip
The [Crystal Reports for Visual Studio 2005 Walkthroughs|http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/2081b4d9-6864-2b10-f49d-918baefc7a23] will also be good to look at.
Ludek
Follow us on Twitter
http://twitter.com/SAPCRNetSup -
How to create a schema and assign roles with store procedure or function?
Hi All,
I am creating a webpage that will call oracle store procedure or function to create a schema and add roles. Please let me know if there a method to do that.
Thank youHi CristiBoboc,
Thank you very much for your help. Here is my code to create a user:
create or replace
FUNCTION user_create (user_name IN nvarchar2, user_pw IN nvarchar2)
RETURN number
IS
sql_stmt varchar2(200);
sql_stmt2 varchar2(200);
var_temp_count NUMBER(2);
un varchar2(30) := user_name;
up varchar2(30) := user_pw;
BEGIN
sql_stmt := 'create user :1 identified by :2
default tablespace users
temporary tablespace temp
quota 5m on users';
sql_stmt2 := 'grant developers to :1';
EXECUTE IMMEDIATE sql_stmt USING un,up;
EXECUTE IMMEDIATE sql_stmt2 USING un;
select count(*) into var_temp_count from dba_users where username = UPPER(user_name);
return var_temp_count;
END;
When I run, I get following error:
exec :myvar :=user_create('aaa','12345');
BEGIN :myvar :=user_create('aaa','12345'); END;
ERROR at line 1:
ORA-01935: missing user or role name
ORA-06512: at "CSDBA.USER_CREATE", line 15
ORA-06512: at line 1 -
Compilation errors with store procedure
Hi guys, I just started SQL so forgive me if I ask any real stupid questions. This is the problem I have right now as said in my title.
This is my procedure.sql
CREATE OR REPLACE PROCEDURE verify IS
no_of_duplicates NUMBER:=0;
BEGIN
SELECT COUNT(*) INTO no_of_duplicates
FROM EMPLOYEE
WHERE E# =
(sELECT E# FROM DRIVER
WHERE EXISTS
(SELECT E# FROM MECHANIC
WHERE DRIVER.L# = MECHANIC.L#));
IF no_of_duplicates:=0 THEN dbms_output.put_line('OK');
ELSE
SELECT E#,NAME FROM EMPLOYEE
WHERE E# =
(SELECT E# FROM DRIVER
WHERE EXISTS
(SELECT E# FROM MECHANIC
WHERE DRIVER.L# = MECHANIC.L#));
END IF;
END verify;
While trying to create the procedure, it gives me the compilation errors. I have been stuck with this for hours and can't seem to find anything wrong with it. Can anyone point me in the right direction? Thanks!Hi,
Once again, post your code. The error occurs when you call the procedure, but you haven't posted the code that calls the procedure and causes the error.
When I do this in SQL*Plus:
SET SERVEROUTPUT ON FORMAT WRAPPED
EXEC verify;
The procedure you posted runs perfectly (that is, is displays the e# only, exactly as it was designed to do).
One way to display both the e# and the name is to BULK COLLECT both the e# and name into separate collections, like this:
CREATE OR REPLACE PROCEDURE verify IS
TYPE e#_table IS TABLE OF employee.e#%TYPE;
e#_list e#_table;
TYPE name_table IS TABLE OF employee.name%TYPE;
name_list name_table;
BEGIN
SELECT e#, name
BULK COLLECT INTO e#_list, name_list
FROM employee
WHERE e# IN (
SELECT d.e#
FROM driver d
JOIN mechanic m ON d.e# = m.e#
IF e#_list.COUNT = 0
THEN
dbms_output.put_line ('OK, there are no illict duplications');
ELSE -- that is, e#_list.COUNT <> 0
dbms_output.put_line ('The following employees are both drivers and mechanics:');
FOR j IN 1..e#_list.COUNT LOOP -- i in parentheses sometimes displays wrong on the OTN site
dbms_output.put ( TO_CHAR ( e#_list (j)
, '999999999999'
dbms_output.put (' ');
dbms_output.put_line (name_list (j));
END LOOP;
END IF;
END verify;
SHOW ERRORS
Here's the output I get when I run the procedure above with your sample data:
The following employees are both drivers and mechanics:
1 John Smith
You'll notice I made several other changes in your code, sometimes because they are clearly better practices, and sometimes just to show you different ways to do the same thing, which you may or may not want to use in this problem.
For example, you were doing the same query (with only very slight differences) 2 times: once to get no_of_duplicates, and then a second time to get the actual data. I don't know if that's the most efficient way to do what you need. Say there are 1000 rows in the result set. You'll fetch all 1000 once just to get the total number, (which you don't need, if all you care about at this point is if there are any), and then to get the data. When you do a BULK COLLECT, you automatically get the COUNT anyway, so why not do the BULK COLLECT first, then use that COUNT to see what you have to do next. If the COUNT is more than 0, then you've already got the data, and you don't need to fetch it again. Also, repeating (essentially) the same code is a maintenance problem. If you ever need to make a change, you need to make the same change in multiple places. At best, that's a pain; but this is the exactly the kind of mistake that is easy to miss in in testing, and you might have code running for weeks in Production before you notice that sometimes it's giving the wrong results.
Another example: e# is a NUMBER. While it is possible to convert NUMBERs into VARCHAR2s, and then store those VARCHAR2s in a VARCHAR2 collecction, wouldn't it make more sense just to store them in a NUMBER collection? -
Interactive Form with Guided Procedure Error
Hi,
I have a guided procedure with a callable object defined to send an email with an attached interactive form. When I execute the guided procedure I keep getting the following error. I have setup the smtp setting under caf/eu/gp/model according to the Configuring GP for Interactive Forms guide.
The mail communication for client application id:0768334F5EF53307986C90435843D119 is not registered. Please contact Bounced Mails administrator:<>
Also note if I have a guided procedure just to send a email notification without an adobe interactive form it works fine.
We are using adobe 8.0 and netweaver 7.0 sp12.
Any help would be appricated.
#1.5 #760960013002006A00000046000BE05C00044AFDAF9A1C6D#1208353340136#com.sap.caf.eu.gp.model.fnd.mail.MCFMailSenderImpl#sap.com/tcwddispwda#com.sap.caf.eu.gp.model.fnd.mail.MCFMailSenderImpl#samuelpo#74##quail_JSD_72617150##664e0c400bb511dd826f760960013002#SAPEngine_Application_Thread[impl:3]_2##0#0#Error#1#/System/Server#Plain###The mail communication for client application id:0768334F5EF53307986C90435843D119 is not registered. Please contact Bounced Mails administrator:<>
com.sap.caf.eu.gp.mail.cf.client.registration.ClientNotRegisteredException: The mail communication for client application id:0768334F5EF53307986C90435843D119 is not registered. Please contact Bounced Mails administrator:<>
at com.sap.caf.eu.gp.mail.cf.core.exceptionhandling.MailCFExceptionHandler.throwClientNotRegisteredException(MailCFExceptionHandler.java:327)
at com.sap.caf.eu.gp.mail.cf.core.registration.impl.MailCommunicationTimerTasksRegistry.checkRegistration(MailCommunicationTimerTasksRegistry.java:303)
at com.sap.caf.eu.gp.mail.cf.core.service.impl.MailCFService$4.send(MailCFService.java:201)
at com.sap.caf.eu.gp.model.fnd.mail.MCFMailSenderImpl.sendMail(MCFMailSenderImpl.java:153)
at com.sap.caf.eu.gp.model.iforms.preproc.FormPreprocessor.execute(FormPreprocessor.java:652)
at com.sap.caf.eu.gp.model.co.background.impl.BackgroundCOExecutorImpl$CallableObjectExecutor.run(BackgroundCOExecutorImpl.java:126)
at com.sap.caf.eu.gp.model.co.background.impl.BackgroundCOExecutorImpl.execute(BackgroundCOExecutorImpl.java:368)
at com.sap.caf.eu.gp.ui.dt.comp.cotest.VTest.executeBackgroundCO(VTest.java:711)
at com.sap.caf.eu.gp.ui.dt.comp.cotest.VTest.onActionExecute(VTest.java:373)
at com.sap.caf.eu.gp.ui.dt.comp.cotest.wdp.InternalVTest.wdInvokeEventHandler(InternalVTest.java:259)
at com.sap.tc.webdynpro.progmodel.generation.DelegatingView.invokeEventHandler(DelegatingView.java:87)
at com.sap.tc.webdynpro.progmodel.controller.Action.fire(Action.java:67)
at com.sap.tc.webdynpro.clientserver.window.WindowPhaseModel.doHandleActionEvent(WindowPhaseModel.java:420)
at com.sap.tc.webdynpro.clientserver.window.WindowPhaseModel.processRequest(WindowPhaseModel.java:132)
at com.sap.tc.webdynpro.clientserver.window.WebDynproWindow.processRequest(WebDynproWindow.java:335)
at com.sap.tc.webdynpro.clientserver.cal.AbstractClient.executeTasks(AbstractClient.java:143)
at com.sap.tc.webdynpro.clientserver.session.ApplicationSession.doProcessing(ApplicationSession.java:321)
at com.sap.tc.webdynpro.clientserver.session.ClientSession.doApplicationProcessingStandalone(ClientSession.java:713)
at com.sap.tc.webdynpro.clientserver.session.ClientSession.doApplicationProcessing(ClientSession.java:666)
at com.sap.tc.webdynpro.clientserver.session.ClientSession.doProcessing(ClientSession.java:250)
at com.sap.tc.webdynpro.clientserver.session.RequestManager.doProcessing(RequestManager.java:149)
at com.sap.tc.webdynpro.serverimpl.defaultimpl.DispatcherServlet.doContent(DispatcherServlet.java:62)
at com.sap.tc.webdynpro.serverimpl.defaultimpl.DispatcherServlet.doPost(DispatcherServlet.java:53)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.runServlet(HttpHandlerImpl.java:401)
at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.handleRequest(HttpHandlerImpl.java:266)
at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:386)
at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:364)
at com.sap.engine.services.httpserver.server.RequestAnalizer.invokeWebContainer(RequestAnalizer.java:1039)
at com.sap.engine.services.httpserver.server.RequestAnalizer.handle(RequestAnalizer.java:265)
at com.sap.engine.services.httpserver.server.Client.handle(Client.java:95)
at com.sap.engine.services.httpserver.server.Processor.request(Processor.java:175)
at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:33)
at com.sap.engine.core.cluster.impl6.session.MessageRunner.run(MessageRunner.java:41)
at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)
at java.security.AccessController.doPrivileged(AccessController.java:219)
at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:102)
at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:172)
Caused by: java.lang.Exception
... 39 moreHi,
I also have a similar issue where i have to validate whether the user submitting the offline form is an user who has authorisation ( a table storing user credentails) .
Were you able to solve this issue of security in offline form.
Appreciate if you can throw some light.
Regards
Jayesh -
Problem with store procedures and Hibernate
I got some problem when I am trying to override INSERT, and UPDATE operations in Hibernate. My delete functions works fine, and everything works when i´m not override with my stored procedure, and I have no idea why. When I am trying to make an INSERT, everything seems to be fine but no data is being insert and no excpetion throws.
When I am trying to make an UPDATE following excpetion throws:
Could not synchronize database state with session
org.hibernate.exception.GenericJDBCException: could not update: [labb6Hibernate.bil#18]
Here is my hbm.xml file:
<hibernate-mapping>
<class catalog="Cars" name="labb6Hibernate.bil" table="Bil">
<id name="idNum" type="java.lang.Integer">
<column name="idNum"/>
<generator class="identity"/>
</id>
<property name="marke" type="string">
<column length="10" name="Marke" not-null="true"/>
</property>
<property name="modell" type="string">
<column length="10" name="Modell" not-null="true"/>
</property>
<property name="arsmodell" type="string">
<column length="4" name="Arsmodell" not-null="true"/>
</property>
<sql-insert callable="true"> { call insertCars(?,?,?) } </sql-insert>
<sql-update callable="true"> { call updateCars(?,?,?) </sql-update>
<sql-delete callable="true"> { call deleteCars(?) } </sql-delete>
</class>
Here is my UPDATE code:
Session session = MyHibernateUtil.getSessionFactory().openSession();
session.beginTransaction();
int s = Integer.parseInt(idTxt.getText());
bil Bil = (bil) session.get(bil.class, s);
Bil.setIdNum(s);
Bil.setMarke(markeTxt.getText());
Bil.setModell(modellTxt.getText());
Bil.setArsmodell(arsmodellTxt.getText());
session.update(Bil);
session.getTransaction().commit();
session.close();
Here is my INSERT code:
Session session = MyHibernateUtil.getSessionFactory().openSession();
session.beginTransaction();
bil Bil = new bil();
Bil.setMarke(markeTxt.getText());
Bil.setModell(modellTxt.getText());
Bil.setArsmodell(arsmodellTxt.getText());
session.save(Bil);
session.getTransaction().commit();
session.close();
Does anyone have an idea what is wrong in my code?I got some problem when I am trying to override INSERT, and UPDATE operations in Hibernate. My delete functions works fine, and everything works when i´m not override with my stored procedure, and I have no idea why. When I am trying to make an INSERT, everything seems to be fine but no data is being insert and no excpetion throws.
When I am trying to make an UPDATE following excpetion throws:
Could not synchronize database state with session
org.hibernate.exception.GenericJDBCException: could not update: [labb6Hibernate.bil#18]
Here is my hbm.xml file:
<hibernate-mapping>
<class catalog="Cars" name="labb6Hibernate.bil" table="Bil">
<id name="idNum" type="java.lang.Integer">
<column name="idNum"/>
<generator class="identity"/>
</id>
<property name="marke" type="string">
<column length="10" name="Marke" not-null="true"/>
</property>
<property name="modell" type="string">
<column length="10" name="Modell" not-null="true"/>
</property>
<property name="arsmodell" type="string">
<column length="4" name="Arsmodell" not-null="true"/>
</property>
<sql-insert callable="true"> { call insertCars(?,?,?) } </sql-insert>
<sql-update callable="true"> { call updateCars(?,?,?) </sql-update>
<sql-delete callable="true"> { call deleteCars(?) } </sql-delete>
</class>
Here is my UPDATE code:
Session session = MyHibernateUtil.getSessionFactory().openSession();
session.beginTransaction();
int s = Integer.parseInt(idTxt.getText());
bil Bil = (bil) session.get(bil.class, s);
Bil.setIdNum(s);
Bil.setMarke(markeTxt.getText());
Bil.setModell(modellTxt.getText());
Bil.setArsmodell(arsmodellTxt.getText());
session.update(Bil);
session.getTransaction().commit();
session.close();
Here is my INSERT code:
Session session = MyHibernateUtil.getSessionFactory().openSession();
session.beginTransaction();
bil Bil = new bil();
Bil.setMarke(markeTxt.getText());
Bil.setModell(modellTxt.getText());
Bil.setArsmodell(arsmodellTxt.getText());
session.save(Bil);
session.getTransaction().commit();
session.close();
Does anyone have an idea what is wrong in my code? -
Front-End Service Starup Error: Store procedure to GET progress vector failed.
Hi,
We have a two front end servers in our Lync deployment and I'm getting an interesting error message on one of the servers when the "Lync Server Front-End Service" is starting up. All the services on that server will eventually start but I'm pretty
sure it's affecting users in some way.
Here is the error message in the Event Viewer:
Log Name: Lync Server
Source: LS User Services
Date: 2013-09-17 8:00:32 AM
Event ID: 32194
Task Category: (1006)
Level: Error
Keywords: Classic
User: N/A
Computer: BGC-VAN-LYNC2.domain.ca
Description:
Store procedure to GET progress vector failed.
Execution Error: 0x00000000(ERROR_SUCCESS).
Native Error: 8144.
Error Details: [# [Microsoft][SQL Server Native Client 11.0][SQL Server]Procedure or function SyncReplicationGetProgressVector has too many arguments specified. #].
Cause: This may indicate a problem with connectivity to local database or some unknown product issue.
Resolution:
Ensure that connectivity to local database is proper. If the error persists, please contact product support with server traces.
Event Xml:
<Event xmlns=>
<System>
<Provider Name="LS User Services" />
<EventID Qualifiers="50158">32194</EventID>
<Level>2</Level>
<Task>1006</Task>
<Keywords>0x80000000000000</Keywords>
<TimeCreated SystemTime="2013-09-17T15:00:32.000000000Z" />
<EventRecordID>16971</EventRecordID>
<Channel>Lync Server</Channel>
<Computer>BGC-VAN-LYNC2.domain.ca</Computer>
<Security />
</System>
<EventData>
<Data>0x00000000(ERROR_SUCCESS)</Data>
<Data>8144</Data>
<Data>[# [Microsoft][SQL Server Native Client 11.0][SQL Server]Procedure or function SyncReplicationGetProgressVector has too many arguments specified. #]</Data>
</EventData>
</Event>
The error happens 15 times every minute, following with this event:
Name: Lync Server
Source: LS User Services
Date: 2013-09-17 8:23:46 AM
Event ID: 32189
Task Category: (1006)
Level: Information
Keywords: Classic
User: N/A
Description:
The following Fabric service for routing groups have been closed:
{F515134C-71B7-52FD-B0C3-6A9DB39CF750}
{8A5D6B36-2A01-53DB-BC4E-3286C05E0836}
{B35AAFC9-F6BF-5FFE-8C31-4AA5C36B2065}
{69223418-78DC-5066-81A8-78E05914EC7B}
{80414C96-1137-5DDC-8387-C3EA7A54B078}
{641E6ABD-B862-55A1-B1B1-C83BC92D2F85}
{1EA68EA4-77F7-5CFC-B781-0093CBC18403}
{2FDE333D-FF7F-5D6A-B85B-93ADC1EAC12A}
{A43BBA3A-8963-51C4-BD7A-19E1EC3DDFDB}
{D3F4532F-61C8-5072-9B3B-3E2CCF15442F}
{4449243E-5E96-56AC-AB6B-C5E785543542}
{58B30261-65B6-5F6A-BC50-60F85782D052}
{DB4B76B0-2510-5BF8-A7B1-8B37BD3AA7B9}
{917CC217-966B-56AC-A912-97BA64BA13EB}
Anyone knows what this is about and how to resolve this?
Thanks,
VH.Hi,
Please try to reset registrar state:
http://tsoorad.blogspot.in/2013/04/lync-2013-ee-pool-wont-start.html
Note: Microsoft is providing this information as a convenience to you. The sites are not controlled by Microsoft. Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there. Please make
sure that you completely understand the risk before retrieving any suggestions from the above link.
Kent Huang
TechNet Community Support -
Error while executing store procedure
we are using JSQLConnect jdbc driver 3.0 verson.
When we trued to excute store procedures its giving error like
com.jnetdirect.jsql.w: Stored procedures called with static parameters cannot return output parameter values, please use CallableStatement.setXXX() to set the values of all input parameters.
we are using SQLServer2000.
Could anybody tell me why this is error is coming and how to solve this.
Thanks
HemanthObviously it doesn't like the stored procedure. If you posted the signature for that it might help.
You are using a CallableStatement right? -
About JDBC CALL STORE PROCEDURE with out parameter is greater than 4000
Hi Guys,
I have a problem call store procedure with a large string.
as i know varchar2 can contain 32767 characters in pl/sql .
But when i used varchar2 as a out parameter in a store procedure, if the out parameter is greater than 4000 characters , it always give me error message as 'the buffer is too small'.
why it happened?
I read some article that says i need configure a property in data-source.xml , and jdbc 10g driver already solved this problem, but i used jdev 10.1.3.2 ,the driver should be fine.
How can i solve this problem?
Thanks in advance,
AppCatObject is Foundation, Execute Script
This is for a query, you can change to a stored procedure call. Pull the value back in the Java code then put into the process variable.
import javax.naming.InitialContext;
import javax.sql.DataSource;
import java.sql.*;
PreparedStatement stmt = null;
Connection conn = null;
ResultSet rs = null;
try {
InitialContext ctx = new InitialContext();
DataSource ds = (DataSource) ctx.lookup("java:IDP_DS");
conn = ds.getConnection();
stmt = conn.prepareStatement("select FUBAR from TB_PT_FUBAR where PROCESS_INSTANCE_ID=?");
stmt.setLong(1, patExecContext.getProcessDataLongValue("/process_data/@inputID"));
rs = stmt.executeQuery();
rs.next();
patExecContext.setProcessDataStringValue("/process_data/outData", rs.getString(1));
} finally {
try {
rs.close();
} catch (Exception rse) {}
try {
stmt.close();
} catch (Exception sse) {}
try {
conn.close();
} catch (Exception cse) {} -
How to call a Store Procedure with IN PARAMETER
Hi, im new using Oracle 10G with Oracle SQL Developer, my cuestion is how to call a Store Procedure with IN PARAMETER, I tried the following without results
SELECT * FROM procedure_name(parameter);
PROCEDURE procedure_name(parameter);
EXEC procedure_name(parameter);
CALL procedure_name(parameter);
Please help me....Hi,
As Beijing said,
EXEC procedure_name(parameter);
CALL procedure_name(parameter);work for me.
So does
BEGIN
procedure_name(parameter);
END;Can you be more specific about what you're doing? That is, are you testing it in SQL Developer? Where are you entering the commands? Where are you looking for output? Do you get error messages? Does anything else (like "SELECT SYSDATE FROM dual;") work? -
Trigger error in a call store procedure (ORA-06512)
Hi all,
I have a trigger (TRLFACTSIN) that update stock when delete, insert or update a record in a sales table. Inside the trigger call a store procedure (PCALCULASTOCK2), he is the manager of calculating and update the stock .
Any idea?, Thanks
Error description:
UPDATE "ALCAR"."LFACTSIN" SET CANTIDAD = '10' WHERE ROWID = 'AAA0D9AAAAAACvdAAA'
One error saving changes to table "ALCAR"."LFACTSIN":
Row 7: ORA-04091: table ALCAR.LFACTSIN is mutating, trigger/function may not see it
ORA-06512: at "ALCAR.PCALCULASTOCK2", line 114
ORA-06512: at "ALCAR.TRLFACTSIN", line 31
ORA-04088: error during execution of trigger 'ALCAR.TRLFACTSIN'
Trigger DDL:
create or replace
Trigger trLFACTSIN
AFTER INSERT OR DELETE OR UPDATE ON LFACTSIN
for each row
Declare
darticulo varchar2(13);
resultado integer default 0;
bEjecutar boolean default True;
ofic1 char(1);
begin
if (inserting) then
darticulo := :new.cod_articulo;
ofic1 := :new.oficial;
end if;
If (deleting) Then
darticulo := :old.cod_articulo;
ofic1 := :old.oficial;
end if;
If (Updating) Then
-- En el caso que sea actualización miramos si la se modificó la cantidad
if :old.cantidad = :new.cantidad Then
darticulo := '';
bEjecutar := False;
else
darticulo := :new.cod_articulo;
ofic1 := :new.oficial;
end if;
end if;
--Ejecutamos el procedimiento almacenado para actualizar el stock en el semielaborado
If bEjecutar Then
--Comprobamos si es semielaborados
Select Count(*) into resultado from semielab Where cod_semielab = darticulo;
-- Ejecutamos el procedimiento almacenado que calcula y actualiza el stock para el semielaborado
If resultado <> 0 Then
PCALCULASTOCK2(darticulo, ofic1);
resultado:=0;
end if;
End If;
End;Whilst the table with the trigger on it is in the middle of a transaction you cannot select or use DML against it. This is what Oracle calls a "mutating table". It doesn't make sense to try and use a table that is in the middle of changing.
You can use an autonomous transaction to work around this issue, but you should be careful with autonomous transactions because there are drawbacks relating to maintaining transaction consistency. Effectively it means you will be making alterations to B based on the fact that A has happened, but the transaction on B will not get rolled back if A fails at any point which could leave you with A not complete but B complete, hence the inconsistency. -
Using store procedures with SQLJ - please help!
I have two questions:
1.I wrote simple test appllication that uses SQLJ to run store
procedures from SQL package. It compiles and work fine from
JDeveloper 3 if I use java version JDK1.2.2_JDeveloper.
It compiles OK in regular JDK1.2.2 but raise the following
exception when running:
profile
com.itrade.trserver.truser.dbqueries.ItrHistorian_SJProfile0 not
found: java.io.InvalidClassException: [Ljava.lang.Object;;
Serializable is incompatible with Externalizable
Does it mean that I have to use JDeveloper JDK?
2.When I give other then default package for *.sqlj file the
*.sqlj file is added to project but I cannot see it in specified
package (the *.sqlj file is created in the its directory).
After I compile the project the I can see *.java file in the
specified package, but compiler gives errors about redefined
symbols. If I remove *.sqlj file from the project it compiles OK.
What I am doing wrong?
Yakov Becker
nullThank you for the response.
I don't create jar file. I run it from JDeveloper environment.
What do you mean by "I made sure to also copy over the
: the .ser file"? What purpose of the *.ser file in this case?
Yakov
JDeveloper Team (guest) wrote:
: I have come across this error before..
: I'm assuming that your jar file is in the classpath as
: specified in the Jserv configuration?
: When I had the error, I made sure to also copy over the
: the .ser file.
: In my case, I happened to have both my class files and
: the .ser file outside of a jar file and it worked..
: Hope this helps!
: Yakov Becker (guest) wrote:
: : I have two questions:
: : 1.I wrote simple test appllication that uses SQLJ to run
store
: : procedures from SQL package. It compiles and work fine from
: : JDeveloper 3 if I use java version JDK1.2.2_JDeveloper.
: : It compiles OK in regular JDK1.2.2 but raise the following
: : exception when running:
: : profile
: : com.itrade.trserver.truser.dbqueries.ItrHistorian_SJProfile0
: not
: : found: java.io.InvalidClassException: [Ljava.lang.Object;;
: : Serializable is incompatible with Externalizable
: : Does it mean that I have to use JDeveloper JDK?
: : 2.When I give other then default package for *.sqlj file the
: : *.sqlj file is added to project but I cannot see it in
: specified
: : package (the *.sqlj file is created in the its directory).
: : After I compile the project the I can see *.java file in the
: : specified package, but compiler gives errors about redefined
: : symbols. If I remove *.sqlj file from the project it
compiles
: OK.
: : What I am doing wrong?
: : Yakov Becker
null -
About call the store procedure using VB with ODBC
I want to ask how can I use the vb with ODBC call the oracle's store procedure ? I try to pass the parameter from vb and return 1 result, it is ok, but when I try to pass 1 parameter with return mutiple result (put it in recordset), the error message occured(Multiple-step OLE DB operation generated errors. Check each OLE DB status value, if available, No work was done) why ?? I can success whit using OLE DB, but why not in ODBC ?? does anybody can help me ?? Thanks a lot.
oh, really ? it is not use ODBC to connecto to oracle ?
Here is my program code:
STORE PROCEDURE:
PROCEDURE getInforcePolicy(PClient_ID IN VARCHAR2, PPolicy_No IN VARCHAR2, BasicCur OUT oraoledb.m_refcur, RiderCur OUT oraoledb.m_refcur)
IS
BEGIN
OPEN BasicCur FOR SELECT * FROM
inforce200111 WHERE Client_ID = PClient_ID and Policy_No = PPolicy_No and coverage_No = 1;
OPEN RiderCur FOR SELECT * FROM
inforce200111 WHERE Client_ID = PClient_ID and Policy_No = PPolicy_No and coverage_No <> 1;
END getInforcePolicy;
PACKAGE oraoledb AS
TYPE m_refcur IS REF CURSOR;
END oraoledb;
Program:
Dim cn As New ADODB.Connection
Dim rs As New ADODB.Recordset
Dim rs2 As New ADODB.Recordset
Dim cmd As New ADODB.Command
Dim paramclient As New ADODB.Parameter
Dim parampolicy As New ADODB.Parameter
Dim I As Integer
cn.Open "ridev", "abc","abc"
cmd.ActiveConnection = cn
Set paramclient = cmd.CreateParameter("PClient", adVarChar, adParamInput, 10)
Set parampolicy = cmd.CreateParameter("PPolicy", adVarChar, adParamInput, 10)
paramclient.Value = "0000023011"
parampolicy.Value = "HK0010021U"
cmd.Parameters.Append paramclient
cmd.Parameters.Append parampolicy
cmd.CommandText = "{call getInforcePolicy}"
Set rs = cmd.Execute
Do While Not rs.EOF
Loop
Set rs2 = rs.NextRecordset
Do While Not rs2.EOF
loop
Where the RIDEV is a datasource that created from Data Source in Control Panel using the driver call "Microsoft ODBC for ORACLE" -
I've been unable to use iTunes for over 3 weeks now.
Initially, it would prompt me to Sign In with my Apple ID and password each time it tried to start, and when I clicked Sign In, it'd respond with variations of:
"Your device or computer could not be verified. Contact support for assistance."
or
De-authorize/Authorize.
Frustrated, I'd click Cancel, and it'd crash with:
"An unknown error occurred (-1008)."
or
"An unknown error occurred (-50)."
More recently, I don't even get the Sign In prompt any more. iTunes now just crashes immediately with unknown error (-50) as soon as it tries to start.
It is clear that this issue has more to do with the Apple ID than with iTunes specifically, because some of the apps I purchased directly from the App Store (OmniFocus, Fantastical and Forismatic) now prompt me to Sign In with my Apple ID and password each time they try to start, and they never did before. And when I try to sign, they respond with the error:
"Your device or computer could not be verified. Contact support for assistance."
Apparently, this is an issue a whole lot of people are experiencing, judging by the long list of Google search returns on the subject; but I'm yet to find a definitive, "official" Apple solution to the problem.
My Apple ID is the same as it's always been.
If anyone knows what's really causing this and/or can offer a fix, please H-E-E-E-L-P? I'll even pay to make it go away. I abandoned Windows after 26 years, only to discover that no platform is spared the blackhole of unknown errors.
-- Chima.iTunes: Advanced iTunes Store troubleshooting - http://support.apple.com/kb/TS3297 > Specific Conditions and Alert Messages: (Mac OS X / Windows) - includes list of iTunes error codes
-
Error message when issuing a COMMIT in a store procedure
Hello experts,
Please help.
I have a problem where i cannot specify a COMMIT in a store
procedure. I have the following error message:
=================================================================
00034, 00000, "cannot %s in current PL/SQL session"
// *Cause: An attempt was made to issue a commit or rollback
from a PL/SQL
// object (procedure, function, package) in a session
which has this
// disabled (by 'alter session disable commit in
procedure')
// *Action: enable commits from PL/SQL in this session, or don't
attempt
// to use commit or rollback in PL/SQL when they are
disabled
// in the current session.
=================================================================
Thanks very much for a reply
Kind regards
YogeerajThe solution is to issue the statement
alter session enable commit in procedure;
However, I'd think carefully about doing this. Procedures are
often called as part of a wider transaction. If the procedure
issues a commit ALL the preceding work is also commited. If
there is something subsequent in the transaction that fails and
issues a rollback, it will onlt rollback the work done after the
procedure. This may lead to your database being in an
inconsistent state.
rgds, APC
Maybe you are looking for
-
ADF panel opening too many JDBC Thin Client database sessions.
Hi All, I have several ADF Panels, which allows the user to run a few simple queries against an Oracle database done using ADF view objects and ADF view links and ADF application module. Each ADF panel as I said contains several View Link queries, an
-
mac pro 3.1 osx 10.8.5 I get these errors in my console what do i have to do with NSImage warning and what with SMC error ??? 18/10/14 3:25:19.633 PM DashboardClient[410]: *** WARNING: -[NSImage compositeToPoint:operation:] is deprecated in MacOSX 10
-
Hey, I have an iOS app that uses the iAD network. A user who has downloaded the app in France can see an iAd banner fine, but I cannot see any iAd banners myself. I am from the UK. In my account, I have the following stats over the past 14 days: 51,6
-
Problem in displaying Column Heading using JTable
I am using JTable component in my applet. I am trying to retrieve records from a database and want to display the same in the table using JTable component. In that procees my data is shown in the table but I am not able to display the column heading.
-
Hello, I am a new to java.
I have a trouble.This is classpath error.Help.