Problem with Parameter on stored procedure for in() condition
Hello,
I would like to pass a parameter to a stored procedure like :
procedure sps_country(zones varchar2)
is
begin
select * from country where zone in (zones);
end sps_country;
My problem is : when i have one value in "zones" parameter all is OK but when i have 2, 3 ... values in zones with this format : ##, ##, ## there is no error, but there is no results found.
have you a solution please ?
Thanks
Also this document has some suggestions.
Similar Messages
-
Problem with parameter of stored procedure....
HI,
I've this stored procedure:
CREATE OR REPLACE procedure ST_DAT (NAME_IN VARCHAR2) as
BEGIN
insert into REP_NAME
select COD_ID,DESCR_ID,AREA, NAME_IN, sysdate
from REP_TAB;
COMMIT;
END ST_DAT;
this procedure is called from an external program
It run correctly, but I have any problem when I tried to insert into tab REP_NAME one value of NAME_IN
with apostrophe.
for example if I write (from external program) Mary run correctly, but If I write Mary's Bar I get
this error:
ORA-01756: quoted string not properly terminated.
I tried with REPLACE:
insert into REP_NAME
select COD_ID,DESCR_ID,AREA, REPLACE(NAME_IN,'',''''), sysdate
from REP_TAB;
BUT I GET SAME ERROR:
How can I call this procedure with apostrophe?
Thanks in advance!You need to handle this in the calling program by escaping the apostophe with another apostrophe...
exec st_dat('Mary''s Bar')Of course that's easy to do when I'm typing in a literal. It's a bit trickier to automate :)
Cheers, APC -
Stored Procedure for Accounts Receivable
Hi. First off, apologies in advance if I have put this question into the wrong topic. Secondly, I first saw SAP 3 weeks ago when I stared my new job and have had no training so please bear with me if some of what I ask doesn't make much sense.
OK, the issue is this. In SAP B1, there is a built in Report called "Customer Receivables Aging" which allows you to see Customer Receivable Accounts by age (e.g 0-30, 31-60, 61-90, 90+) and so on. The problem with the built in report is that it doesn't show all the fields I want - it only shows the Customer Name, balance, and then the aging balances. I want to be able to see things like the customer's contact details, etc. I know this makes no sense because the whole point of the report is to be able to drill down into the different rows, but this report needs to be issued in printed form, hence the need for the extra fields.
Since I can't seen any way from within SAP to change the fields returned by this report, I thought I'd have a stab at writing my own SQL to select out the same data along with the extra fields I wanted. That's when the problems began...try as I might, I cannot get my figures to tally with the SAP Report.
They are almost correct, but not quite. I am sure that I am missing a selection or some other element of the logic that B1 uses to create the built in report.
If you want, I can post the SQL I'm using....I'm not an SQL guru by any means, but I do know my way around it; the biggest problem I have is that I cannot find any documentation as to the 4 letter tables that SAP uses and their relationships except on the most basic level (e.g ORIN is Open Return Invoice [maybe])
Then I thought maybe it might be possible to edit that report section in B1 using the SDK. That would be a better solution as I would not have to 'reinvent the wheel', I can just SELECT an extra field or three to include in the report.
So my question is
->Does anyone have a stored procedure for SQL Server that can replicate correctly the SAP B1 "Customer Receivable Aging", even just the process SAP uses to gather this data would be good.
OR
is it possible to edit this report in SAP to put in the extra fields I want.
Or, am I totally barking up the wrong tree? Thanks in advance, I know this is a long post.Hi Stephen,
There should be a print layout attached to the on-screen report. This can be altered to show the additional fields you want without resorting to SDK or SQL development.
When you have the Customer Receivables Ageing report open on screen, choose Tools-Print Layout Designer or click on the Print Layout Designer icon on the toolbar. When prompted, choose the layout you wish to edit and you'll be taken to the layout design. In the layout, you can add additional fields and should be able to add most business partner fields. As the report is set to portrait by default, I recommend changing it to landscape so you have lots more space to add the extra fields you want. This report writer is fairly intuitive, if a little basic.
You will need to save this new report design, set it to be the default layout and then when you select to print the Customer Receivables Ageing report (ie Print Preview or Print) you will see the new report.
Hope this helps,
Owen -
Stored procedure for disabling all foreign key constraints ?
hi all,
I need a stored procedure for disabling / enable all constraints in that database schema.
Create or replace procedure enable_disable_proc(status varchar2(3),schema_name varchar2(20))
---> where 'status' parameter condition should be ( YES for enable) (NO for disable)
---> 'schema_name' is a parameter where ,only this schema should be affected with this procedure..
Thanks in Advance..Hi,
Try this code
/* Formatted on 2009/07/16 08:15 (Formatter Plus v4.8.8) */
CREATE PROCEDURE enab_disab_proc (
enforce IN VARCHAR2,
current_schema IN VARCHAR2
IS
v_alter_table_sql VARCHAR2 (2000);
BEGIN
FOR rec_con IN (SELECT table_name, constraint_name
FROM user_constraints
WHERE owner = current_schema)
LOOP
IF (enforce = 'NO')
THEN
v_alter_table_sql :=
' alter table '
|| current_schema
|| '.'
|| rec_con.table_name
|| ' disable constraint '
|| rec_con.constraint_name;
ELSE
v_alter_table_sql :=
' alter table '
|| current_schema
|| '.'
|| rec_con.table_name
|| ' enable constraint '
|| rec_con.constraint_name;
END IF;
EXECUTE IMMEDIATE v_alter_table_sql;
END LOOP;
END;Edited by: Salim Chelabi on 2009-07-16 05:15 -
Problem while using oracle stored procedure in VC
Hi All,
I have created JDBC system and connected my locally installed Oracle data base to the VC. I mapped the data base user to my VC user. I tested connection and it is fine. Further I see the DB alias in Visual Composer and I can drop stored procedures to my story board. I can define parameters, but when I am executing procedures I get the error message.
Problem: I can not execute stored procedures stored in Oracle data base. Error Message: Portal request failed. Could not execute stored procedure.
In the stored procedure, I have used select query, that returns set of records, so that I have used REF CURSOR as OUT Parameter. Is REF CURSOR supported by VC?. Else, any tricks available to solve this problem?.
Note: Stored Procedure of Sql server is working fine in VC.
Thanks,
Venkatesh RReturning (or sending in) multiple rows directly from (or to) a stored procedure is not currently possible. I have been in contact with SAP on this subject earlier, and they suggest using a web service to do the job. I used this as a work around, calling the stored procedure from a web service. I send in VC tables to this web service, and this in turn contacts my stored procedure.
The problem is related to the connector framework in the J2EE environment.
I am on 7.0 sps 17
If you use stored procedure single value parameters of type varchar, number ... then VC has no problem communicating with your procedures.
Good luck
Henning Strand -
Passing parameter into stored procedure
Hi guys,
I have a big problem here passing as a parameter in stored
procedure.
If i pass as a parameter in where clause it is working fine.
Whenever i pass the parameter in order by it was not working..
How to implement this issue????
Here i am giving the example for package:
PACKAGE XTRA.TEST_STATUS
AS
TYPE GenericCurTyp IS REF CURSOR;
PROCEDURE SP_MAIN
( insortgroup IN VARCHAR2,GENERAL_CUR IN OUT GenericCurTyp);
END TEST_STATUS;
PACKAGE BODY XTRA.TEST_STATUS
AS
PROCEDURE SP_MAIN
( insortgroup IN VARCHAR2, GENERAL_CUR IN OUT GenericCurTyp
) AS
BEGIN
OPEN GENERAL_CUR FOR
select last_name,first_name from applicant Order By insortgroup;
END SP_MAIN;
END TEST_STATUS;
Passing as a parameter i am getting the below details.
LAST_NAME FIRST_NAME
ASFSDAF DASDFASF
Ad DASD
Adams John
DANA WITEST
If i hot code the parameter insortgroup to last_name
i am getting the below values:
LAST_NAME FIRST_NAME
'ANNUNZIO GIANCOLA GABRIEL
0'BRIEN ARMA
0120453EZ ESTANISLAO
082479 ELIZABETH
Thanks,
RaoCREATE OR REPLACE PACKAGE xtra.test_status
AS
TYPE GenericCurTyp IS REF CURSOR;
PROCEDURE sp_main
(insortgroup IN VARCHAR2,
general_cur IN OUT GenericCurTyp);
END test_status;
CREATE OR REPLACE PACKAGE BODY xtra.test_status
AS
PROCEDURE sp_main
(insortgroup IN VARCHAR2,
general_cur IN OUT GenericCurTyp)
AS
select_statement VARCHAR2 (4000) := NULL;
BEGIN
select_statement :=
'SELECT last_name,
first_name
FROM applicant
ORDER BY ' || insortgroup;
DBMS_OUTPUT.PUT_LINE (select_statement);
OPEN general_cur FOR select_statement;
END sp_main;
END test_status; -
Stored Procedure for Crystal Reports
Hi All,
I developed this test stored procedure to see wheather we could a stored procedure for crystal reports. It compiled without any problem, but when I run it, it gives me error message. Here is the stored Procedure..
CREATE OR REPLACE PROCEDURE WOLD1SIM.TEST_PROCEDURE(
TEST_CURSOR IN OUT TEST_PACKAGE.TEST_TYPE,
TEST_PARAMETER IN TEST_TABLE.ID%TYPE)
AS
BEGIN
OPEN TEST_CURSOR FOR
SELECT *
FROM TEST_TABLE
WHERE TEST_TABLE.ID = TEST_PARAMETER;
END TEST_PROCEDURE;
And
This is the error message..
ERROR at line 2:
ORA-06550: line 2, column 1:
PLS-00201: identifier 'TEST_PROC' must be declared
ORA-06550: line 2, column 1:
PL/SQL: Statement ignored
I have created the package sucessfully.
I was wondering If any one of you can advice me where I am making the mistake.
Thank youCREATE OR REPLACE PROCEDURE WOLD1SIM.TEST_PROCEDURE(TEST_CURSOR IN OUT TEST_PACKAGE.TEST_TYPE,
TEST_PARAMETER IN TEST_TABLE.ID%TYPE)
...you have 2 parameters in your procedure WOLD1SIM.TEST_PROCEDURE(). you should also use two parameters when you execute the procedure. -
I created a stored procedure for send data from a source bd to the bd destination with a link between BD
But it will not work
CREATE OR REPLACE PROCEDURE archivage ( source IN VARCHAR2, destination IN VARCHAR2)
BEGIN
/ * - Prepare a cursor to select from the bd_source: * /
source_cursor: = dbms_sql.open_cursor;
DBMS_SQL.PARSE (source_cursor,
'SELECT table_name FROM dba_tables' | | source,DBMS_SQL.NATIVE);
LOOP i in source_cursor
/* Or i use this !!!!
SELECT object_name FROM dba_objects WHERE owner = 'SCOTT' AND object_type = 'TABLE'*/
DBMS_SQL.DEFINE_COLUMN (source_cursor, i);
end loop
ignorer: DBMS_SQL.EXECUTE = (source_cursor);
/ * - Prepare a cursor to insert into the destination db: * /
destination_cursor: = DBMS_SQL.OPEN_CURSOR;
DBMS_SQL.PARSE (destination_cursor,
'INSERT INTO' | | destination | | DBMS_SQL.NATIVE);
/ * - Fetch a row from the source table and insert it into the destination table: * /
loop
if DBMS_SQL.FETCH_ROWS (source_cursor)> 0 ALORS
- Obtenir des valeurs de colonne de la ligne
DBMS_SQL.COLUMN_VALUE (source_cursor,i);
DBMS_SQL.BIND_VARIABLE (destination_cursor,i);
ignorer: DBMS_SQL.EXECUTE = (destination_cursor);
ELSE
EXIT;
End If;
END LOOP;
/*-Close cursor */
COMMIT;
DBMS_SQL.CLOSE_CURSOR (source_cursor);
DBMS_SQL.CLOSE_CURSOR (destination_cursor);
EXCEPTION
WHEN OTHERS, THEN
if
DBMS_SQL.IS_OPEN (source_cursor)then
DBMS_SQL.CLOSE_CURSOR (source_cursor);
End If;
if DBMS_SQL.IS_OPEN (destination_cursor) then
DBMS_SQL.CLOSE_CURSOR (destination_cursor);
End If;
RAISE;
END;find 10 differences ... :(
CREATE OR REPLACE PROCEDURE archivage (source IN VARCHAR2,
destination IN VARCHAR2)
IS
source_cursor INTEGER;
destination_cursor INTEGER;
ignorer INTEGER;
BEGIN
/* - Prepare a cursor to select from the bd_source: */
source_cursor := DBMS_SQL.open_cursor;
DBMS_SQL.
PARSE (source_cursor,
'SELECT table_name FROM dba_tables' || source,
DBMS_SQL.NATIVE);
FOR i IN source_cursor
LOOP
/* Or i use this !!!!
SELECT object_name FROM dba_objects WHERE owner = 'SCOTT' AND object_type = 'TABLE'*/
DBMS_SQL.DEFINE_COLUMN (source_cursor, i);
END LOOP;
ignorer := DBMS_SQL.EXECUTE (source_cursor);
/* - Prepare a cursor to insert into the destination db: */
destination_cursor := DBMS_SQL.OPEN_CURSOR;
DBMS_SQL.
PARSE (destination_cursor,
'INSERT INTO ' || destination,
DBMS_SQL.NATIVE);
/* - Fetch a row from the source table and insert it into the destination table: */
LOOP
IF DBMS_SQL.FETCH_ROWS (source_cursor) > 0
THEN
--ALORS
-- Obtenir des valeurs de colonne de la ligne
DBMS_SQL.COLUMN_VALUE (source_cursor, i);
DBMS_SQL.BIND_VARIABLE (destination_cursor, i);
ignorer := DBMS_SQL.EXECUTE (destination_cursor);
ELSE
EXIT;
END IF;
END LOOP;
/*-Close cursor */
COMMIT;
DBMS_SQL.CLOSE_CURSOR (source_cursor);
DBMS_SQL.CLOSE_CURSOR (destination_cursor);
EXCEPTION
WHEN OTHERS
THEN
IF DBMS_SQL.IS_OPEN (source_cursor)
THEN
DBMS_SQL.CLOSE_CURSOR (source_cursor);
END IF;
IF DBMS_SQL.IS_OPEN (destination_cursor)
THEN
DBMS_SQL.CLOSE_CURSOR (destination_cursor);
END IF;
RAISE;
END;
/ -
Pass a date parameter to Stored Procedure
Hello friends,
Can you help to pass a date parameter to Stored procedure from JSP. This is my code:
In Oracle 9i I have this:
PROCEDURE SP_EDORES(
pfechaini IN hist_pol_reclama.hrc_fecha_contabilidad%Type, <-- This is a date field
pfechafin IN hist_pol_reclama.hrc_fecha_contabilidad%Type, <-- This is a date field
p_recordset OUT PKG_REP_CIERRE.cursor_type) AS
In JSP have this:
CallableStatement stmt = (CallableStatement)conn.prepareCall( "begin PKG_REP_CIERRE.SP_EDORES(?,?,?); end;" );
stmt.registerOutParameter(3,oracle.jdbc.driver.OracleTypes.CURSOR);
stmt.setDate(1,Date.valueOf("01-06-2005"));
stmt.setDate(2,Date.valueOf("30-06-2005"));
ResultSet rset = (ResultSet)stmt.getObject(3);
while (rset.next()) {
%>
<TR>
<TD ALIGN=CENTER> <%= rset.getString(1) %> </TD>
<TD ALIGN=CENTER> <%= rset.getString(2) %> </TD>
<TD ALIGN=CENTER> <%= rset.getString(3) %> </TD>
<TD ALIGN=CENTER> <%= rset.getInt(4) %> </TD>
</TR>
<%
The Stored Procedure returns de Result set, however I think does not recognized the date format because I need it with this format dd-mm-yyyy.
Thanks in advanceto use Date you will need the oracle package.
u can try this other solution: use String, not Date
CallableStatement stmt = (CallableStatement)conn.prepareCall( "begin PKG_REP_CIERRE.SP_EDORES(?,?,?); end;" );
stmt.registerOutParameter(3,oracle.jdbc.driver.OracleTypes.CURSOR);
stmt.setString(1,"01-06-2005");
stmt.setString(2,"30-06-2005");
ResultSet rset = (ResultSet)stmt.getObject(3);
while (rset.next()) {
%>
if this don't work you can change your PL/SQL to get Strings and do the conversion with TO_DATE in the sql statement. -
Problems with Parameter Mapping
Hi All,
I have problems with parameter-mapping. For me its a black box, sometimes it works sometimes not.
Lots of times my mappings doesnt work, and I dont know the reason.
For example: I want to map my Execution-CO to the Display-CO. For that I map the in the affected Action.
But it doesnt work, although I do have the same Context Structures, because its the same CO. The technical Name is also the same.
What could it be?
Thanks for answering me
Bye SteveHi Andre,
sorry for my late answer, but I'm writing my diploma thesis and wasnt at work since wednesday and so I dont have a access to our GP-System.
Hope I understood you right.
The Use Case of parameter mapping is that Users of further steps has the possibility to see the Input of previous steps.
When I dont map the parameter inside one action, it isnt possible. I tried it out with the SAP example "Time-off-process". I took the CO "Create Request" and add it in one Action (as Display & Execution). When I understand you right mapping inside an action is not necessary, to see the Inputs from further Actions --> But this way I cannot see the Inputs.
The mapping of my application works before I changed it.
I know never touch a running system, but It was necessary, we need a new Input and Output Parameter.
Cause I have 20 parameter the mapping was very time-consuming, to map every single parameter. I read a method to reduce the time: Adding a structure requires only mapping of the two structures. But now the Mapping doesnt work.
Hope you can help me
Bye Steve -
Using a stored procedure for a sender jdbc adapter
Hi all,
The requirement is to use a stored procedure, for extracting data from a oracle database.
Is it possible to do this.
If yes, what should be the source structure in this case.
Please help with the exact soln.
Thanks!!
YounusHi,
Did you check the blog pointed by Aamir?
/people/jegathees.waran/blog/2007/03/02/oracle-table-functions-and-jdbc-sender-adapter
You will need to use Oracle Functions instead of Oracle Stored Procedures. Read thru the blog and the note pointed in the blog . Think it is quite a good example.
Regards
Bhavesh -
Problems with parameter button in Crystal Report Server 2008
Dear all,
I have problems with parameter button in Crystal Report Server 2008.
when I created some parameters and groups in Crystal Report 2008, they showed both parameters in 'Parameter button' and group in 'Group button' on the left, so I can choose or type without clicking 'Refresh button' But when I added it to Crystal Report Server 2008 and I click parameter button , it doesn't show any parameter. Only click refresh button to choose them. On the other hand, for 'Group Tree' is ok. When go to Default Setting-> Parameter, all parameters are in 'Unused parameter' First time I think I had problems with my installation, but when I reinstalled it again, it was like before.
Could any one help me with this?
I appreciate looking forward to your reply
KetyaTry posting your questionin the correct forum, this is for SAP Business One, not Crystal reports Server
-
Return a parameter through stored procedures
Hello Experts
I want to return parameter through stored procedures so as to ensure that the application has been executed properly.
My source message format is
<StatementName5>
<storedProcedureName action=u201D EXECUTEu201D>
<table>Summarize_prc</table>
<empid [isInput=u201Dtrueu201D] [isOutput=true] type=SQLDatatype>val1</empid>
</storedProcedureName >
</StatementName5>
Do i need to put some extra parameters for return values from the stored procedures?
What would be the response message format to return the parameters from stored procedure.
Thanks
SabyasachiHi,
If you wants to read the return values from stored procedure, the scanario should be designed as Sync.
The format looks like thsi
<Message Type Name>
<STATEMENTNAME_response>
<Field1> </Field1>
</STATEMENTNAME_response>
</Message Type Name> -
Stored procedures for User Tables
Can somebody please help me with this matter?. I need to add stored procedures for user tables. Is there any way of doing so?.
Thanks in advance.
Ernesto.Ernesto,
You have posted multiple threads for the same question. Please check the other thread and close this one:
Stored procedures in User Tables
Thanks,
Gordon -
Is it possible to pass TABLE as the output parameter in stored procedure
Hey Experts,
Is it possible to pass TABLE as the output parameter in stored procedure.
eg
create procedure spGetData
@tableName as TABLE(intValue INT NOT NUL)
asYou can use OPENQUERY or OPENROWSET, as mentioned above, to make stored procedure results table like. There are
some limitations with these methods:
http://technet.microsoft.com/en-us/library/ms188427.aspx
In OPENQUERY this-sql-server-instance can be used instead of a linked server name. It requires setting data accces server option:
exec sp_serveroption @server = 'PRODSVR\SQL2012'
,@optname = 'DATA ACCESS'
,@optvalue = 'TRUE'
LINK: http://www.sqlusa.com/bestpractices/select-into/
Kalman Toth Database & OLAP Architect
SELECT Video Tutorials 4 Hours
New Book / Kindle: Exam 70-461 Bootcamp: Querying Microsoft SQL Server 2012
Maybe you are looking for
-
CPUZ REPORTING FULL SPEED ALL THE TIME, help ?
I have cpuz 1.52.2, its constantly reporting that my cpu is running at full speed, it didnt used to be like this, and ive not even been doing anything at all in the bios for months, so i know its not the bios to blame. I have a dual boot system, with
-
After effects cc 2014 text presets can't import from bridge cc
I'm trying to use the presets for text animation but somehow I get the message that it doesn't support this file format. How come? and how to fix?
-
Sequence Settings Frame Size, LIMIT?
I want to export a sequence that's 1080x5760. Essentially 3 1080p screens right next to each other. Every time I enter this custom setting into the frame size of my sequence, I get a 4000 limit for both height and width. Shouldn't FCP be able to hand
-
Lov+shortcut of report 6i on user desktop
hi all i have created a formletter type of report in arabic using reports 6i the content is coming fine ,i mean the arabic data from database like employee name ,employee designation in arabic is coming fine, i require to create an Lov on the compan
-
hey, a friend of mine has the new nvidia graphics card in his pro (256) and is getting poor performance in gaming..and other heavy tasks. is this a problem with the drivers? thanks for all your comments