Call procedure inside from another procedure.
I have Procedure Name stored in tables.
Based on certain logic i need to call some procedure.
Procedure will be called from inside the procedure.
How can i apply this logic.
Please provide any explain.
Regards,
AgrawalV
Message was edited by:
AgrawalV
Example: Re: How to make a dynamic function call from within a package procedure
Similar Messages
-
Calling a procedure (with refcursor) from another procedure
I have a procedure that returns refcursor (it's used by a Java application).
I am able to run the proc via SQLPlus like below:
var a refcursor;
exec MY_PKG.get_content_prc(:a);
print a;
I would like to use/call this proc from another procedure and I am not able to, since arg is refcursor.
create or replace procedure p
is
v refcursor;
begin
MY_PKG.get_content_prc(:v);
end;
Error I get is:
SQL> show err
Errors for PROCEDURE P2:
LINE/COL ERROR
4/3 PL/SQL: Item ignored
4/7 PLS-00201: identifier 'CURSOR' must be declared
6/5 PL/SQL: Statement ignored
6/57 PLS-00320: the declaration of the type of this expression is
incomplete or malformed
Hope someone can direct me.
RegardsBecause you are not using the right syntax.
You need to do something like this
LOOP
/* Fetch from cursor variable. */
FETCH emp_cv INTO emp_rec;
EXIT WHEN emp_cv%NOTFOUND; -- exit when last row is fetched
-- process data record
END LOOP;This is from the PL/SQL User's Guide and Reference.
I would recommend reading this fine manual, it is faster than guessing. -
Unable to call a procedure from inside a another procedure
Dear members
I am trying to call a procedure from inside an another procedure.Both the procedures are present within the same package.I am trying to call the second procedure just before the end of the first procedure.Both the procedures are compiling fine but the tables are not getting populated inside the second procedure.Also the DBMS_OUTPUT statements present in second procedures are not getting displayed.(I feel the second procedured is not getting called).
The package specification is as follows:
CREATE OR REPLACE package ANVESH.conv_api_pkg
is
PROCEDURE PROC_CONVERSION_API(FILE_PATH IN VARCHAR2,FILE_NAME IN VARCHAR2) ;
TYPE cts_order_details IS TABLE OF XXCTS_ORDER_DETAILS_STG%ROWTYPE;
PROCEDURE proc_conversion_api2(p_orderdetails IN cts_order_details) ;
end conv_api_pkg;The package body is as follows:
CREATE OR REPLACE package body ANVESH.conv_api_pkg
is
PROCEDURE PROC_CONVERSION_API(FILE_PATH IN VARCHAR2,FILE_NAME IN VARCHAR2)
IS
v_file_type utl_file.file_type;
v_buffer VARCHAR2(1000);
V_CUSTOMER_NAME VARCHAR2(100);
V_MANUFACTURER VARCHAR2(100);
V_PRODUCT_NAME VARCHAR2(100);
V_QUANTITY NUMBER;
V_REQ_SHIP_DATE DATE;
V_REQ_PRICE NUMBER;
V_LOG_FILE utl_file.file_type;
V_COUNT_CUST NUMBER;
V_COUNT_PROD NUMBER;
L_ORDER_LINES CONV_API_PKG.cts_order_details:=CONV_API_PKG.cts_order_details();
BEGIN
DBMS_OUTPUT.PUT_LINE('Inside begin 1');
v_file_type := UTL_FILE.fopen(FILE_PATH, FILE_NAME, 'r',null);
DBMS_OUTPUT.PUT_LINE('Inside begin 1.1');
LOOP
BEGIN
DBMS_OUTPUT.PUT_LINE('Inside begin 2');
UTL_FILE.GET_LINE (v_file_type,v_buffer);
DBMS_OUTPUT.PUT_LINE('Inside begin 2.1');
DBMS_OUTPUT.PUT_LINE('the buffer is '||v_buffer);
DBMS_OUTPUT.PUT_LINE('the length of buffer is '||length(v_buffer));
V_CUSTOMER_NAME := trim(substr(v_buffer, 1, 30));
DBMS_OUTPUT.PUT_LINE('Customer Name is '||V_CUSTOMER_NAME);
V_MANUFACTURER := trim(substr(v_buffer, 31, 40));
DBMS_OUTPUT.PUT_LINE('Manufacturer is '||V_MANUFACTURER);
V_PRODUCT_NAME := trim(substr(v_buffer, 71, 20));
DBMS_OUTPUT.PUT_LINE('Product Name is '||V_PRODUCT_NAME);
V_QUANTITY := to_number(trim(substr(v_buffer, 91, 5)));
DBMS_OUTPUT.PUT_LINE('Quantity is '||V_QUANTITY);
V_REQ_SHIP_DATE := to_date(trim(substr(v_buffer, 96, 20)), 'DD-MON-YYYY');
DBMS_OUTPUT.PUT_LINE('Requested Ship Date is '|| V_REQ_SHIP_DATE);
V_REQ_PRICE :=nvl(substr( trim(v_buffer), 116, length(v_buffer)-116),0);
--DBMS_OUTPUT.PUT_LINE('Requested Price is1 '||substr(v_buffer, 116, 5));
DBMS_OUTPUT.PUT_LINE('The requested price is '||V_REQ_PRICE);
V_LOG_FILE := UTL_FILE.FOPEN(FILE_PATH, 'LOG_FILE.dat', 'A');
IF (V_QUANTITY > 0)
THEN
DBMS_OUTPUT.PUT_LINE('The quantity is '||V_QUANTITY);
SELECT COUNT (*)
INTO V_COUNT_CUST
FROM CONVERSION_CUSTOMERS
WHERE CUSTOMER_NAME = V_CUSTOMER_NAME;
DBMS_OUTPUT.PUT_LINE('The Customer count is '||V_COUNT_CUST);
IF(V_COUNT_CUST > 0)
THEN
SELECT COUNT(*)
INTO V_COUNT_PROD
FROM conversion_products
WHERE PRODUCT_NAME = V_PRODUCT_NAME;
DBMS_OUTPUT.PUT_LINE('The Product count is '||V_COUNT_PROD);
IF(V_COUNT_PROD >0)
THEN
INSERT INTO XXCTS_ORDER_DETAILS_STG VALUES (V_CUSTOMER_NAME, V_PRODUCT_NAME, V_MANUFACTURER, V_QUANTITY, V_REQ_SHIP_DATE, V_REQ_PRICE, 'ACTIVE', 'ORDER TAKEN');
ELSE
DBMS_OUTPUT.PUT_LINE('PRODUCT SHOULD BE VALID');
UTL_FILE.PUT_LINE(V_LOG_FILE, 'PRODUCT SHOULD BE VALID');
END IF;
ELSE
DBMS_OUTPUT.PUT_LINE('CUSTOMER SHOULD BE VALID');
UTL_FILE.PUT_LINE(V_LOG_FILE, 'CUSTOMER SHOULD BE VALID');
END IF;
ELSE
DBMS_OUTPUT.PUT_LINE('QUANTITY SHOULD BE VALID');
UTL_FILE.PUT_LINE(V_LOG_FILE, 'QUANTITY SHOULD BE VALID');
END IF;
EXCEPTION
WHEN NO_DATA_FOUND THEN
EXIT;
END;
END LOOP;
SELECT CUSTOMER_NAME, PRODUCT_NAME, MANUFACTURER, QUANTITY, REQUESTED_SHIP_DATE, REQUESTED_PRICE, STATUS,MESSAGE
BULK COLLECT
INTO L_ORDER_LINES
FROM XXCTS_ORDER_DETAILS_STG;
DBMS_OUTPUT.PUT_LINE('values inserted');
proc_conversion_api2(p_orderdetails=>L_ORDER_LINES);
END;
PROCEDURE proc_conversion_api2(p_orderdetails IN cts_order_details)
IS
V_AVL_QUANTITY CONVERSION_PRODUCTS.AVL_QUANTITY%TYPE;
V_REQ_SHIP_DATE DATE;
V_LIST_PRICE CONVERSION_PRODUCTS.LIST_PRICE%TYPE;
V_NET_PRICE CONVERSION_PRODUCTS.LIST_PRICE%TYPE;
V_NET CONVERSION_PRODUCTS.LIST_PRICE%TYPE;
V_EXTN_PRICE CONVERSION_PRODUCTS.LIST_PRICE%TYPE;
V_CUST_DISC CONVERSION_CUSTOMERS.DISCOUNT%TYPE;
V_CERT_DISC CONVERSION_CERTIFICATION.DISCOUNT%TYPE;
V_CUST_ID XXCTS_ORDER_DETAILS.CUSTOMER_ID%TYPE;
V_PROD_ID XXCTS_ORDER_DETAILS.PRODUCT_ID%TYPE;
V_DISC_PRICE CONVERSION_PRODUCTS.LIST_PRICE%TYPE;
V_DISC_NAME CONVERSION_CERTIFICATION.CERTIFICATION%TYPE;
V_TOTAL_DISC_AMT NUMBER;
V_TOTAL_DISC NUMBER;
V_LIMIT NUMBER;
BEGIN
DBMS_OUTPUT.PUT_LINE('INSIDE API_2 BEGIN 1');
FOR i IN p_orderdetails.FIRST..p_orderdetails.LAST
LOOP
BEGIN
DBMS_OUTPUT.PUT_LINE('INSIDE API_2 BEGIN 2');
SELECT PRODUCT_ID,AVL_QUANTITY,LIST_PRICE
INTO V_PROD_ID,V_AVL_QUANTITY,V_LIST_PRICE
FROM CONVERSION_PRODUCTS
WHERE PRODUCT_NAME=p_orderdetails(i).PRODUCT_NAME;
DBMS_OUTPUT.PUT_LINE('PRODUCT QUANTITY is '||V_PROD_ID);
DBMS_OUTPUT.PUT_LINE('AVAILABLE QUANTITY is '||V_AVL_QUANTITY);
DBMS_OUTPUT.PUT_LINE('LIST PRICE is '||V_LIST_PRICE);
SELECT CUSTOMER_ID,NVL(DISCOUNT,0)
INTO V_CUST_ID,V_CUST_DISC
FROM CONVERSION_CUSTOMERS
WHERE CUSTOMER_NAME=p_orderdetails(i).CUSTOMER_NAME;
DBMS_OUTPUT.PUT_LINE('CUSTOMER ID is '||V_CUST_ID);
DBMS_OUTPUT.PUT_LINE('CUSTOMER DISCOUNT IS '||V_CUST_DISC);
SELECT A.DISCOUNT,A.CERTIFICATION
INTO V_CERT_DISC,V_DISC_NAME
FROM CONVERSION_CERTIFICATION A,CONVERSION_CUSTOMERS B
WHERE A.CERTIFICATION=B.CERTIFICATION(+)
AND B.CUSTOMER_NAME=p_orderdetails(i).CUSTOMER_NAME;
DBMS_OUTPUT.PUT_LINE('CERTIFICATION DISCOUNT IS '||V_CERT_DISC);
V_NET:=((V_LIST_PRICE)-(V_LIST_PRICE)*(V_CERT_DISC)/100);
DBMS_OUTPUT.PUT_LINE('NET PRICE AFTER CERTIFICATION DISCOUNT IS '||V_NET);
V_NET_PRICE:=((V_NET)-(V_NET)*(V_CUST_DISC)/100);
DBMS_OUTPUT.PUT_LINE('NET PRICE AFTER COMPLETE DISCOUNT IS '||V_NET_PRICE);
V_EXTN_PRICE:=(V_NET_PRICE)*(p_orderdetails(i).QUANTITY);
DBMS_OUTPUT.PUT_LINE('EXTENDED PRICE IS '||V_EXTN_PRICE);
V_TOTAL_DISC:=((V_CERT_DISC)/100+(V_CUST_DISC)/100);
DBMS_OUTPUT.PUT_LINE('TOTAL DISCOUNT IS '|| V_TOTAL_DISC);
V_TOTAL_DISC_AMT:=(V_LIST_PRICE)-(V_NET_PRICE);
DBMS_OUTPUT.PUT_LINE('TOTAL DISCOUNT PRICE IS '|| V_TOTAL_DISC_AMT);
SELECT MAX(A.LIMIT)
INTO V_LIMIT
FROM CONVERSION_CERTIFICATION A,CONVERSION_CUSTOMERS B
WHERE A.CERTIFICATION=B.CERTIFICATION(+)
AND B.CUSTOMER_NAME=p_orderdetails(i).CUSTOMER_NAME;
IF p_orderdetails(i).QUANTITY<V_AVL_QUANTITY THEN
INSERT INTO XXCTS_ORDER_DETAILS VALUES(SEQ_HEADER_ID.NEXTVAL,SEQ_LINE_ID.NEXTVAL,V_CUST_ID,V_PROD_ID,p_orderdetails(i).QUANTITY,p_orderdetails(i).REQUESTED_SHIP_DATE,p_orderdetails(i).REQUESTED_PRICE,V_LIST_PRICE,V_TOTAL_DISC,V_NET_PRICE,V_EXTN_PRICE,'QTY HOLD','REQ QNTY LESS THAN AVL QTY',SYSDATE);
INSERT INTO xxcts_order_discounts VALUES(SEQ_HEADER_ID.NEXTVAL,SEQ_LINE_ID.NEXTVAL,SEQ_DISCOUNT_ID.NEXTVAL,V_DISC_NAME,V_TOTAL_DISC_AMT);
END IF;
IF p_orderdetails(i).REQUESTED_SHIP_DATE<SYSDATE THEN
INSERT INTO XXCTS_ORDER_DETAILS VALUES(SEQ_HEADER_ID.NEXTVAL,SEQ_LINE_ID.NEXTVAL,V_CUST_ID,V_PROD_ID,p_orderdetails(i).QUANTITY,p_orderdetails(i).REQUESTED_SHIP_DATE,p_orderdetails(i).REQUESTED_PRICE,V_LIST_PRICE,V_TOTAL_DISC,V_NET_PRICE,V_EXTN_PRICE,'DATE HOLD','SHIPDATE CANNOT BE LESS THAN CURR DATE',SYSDATE);
INSERT INTO xxcts_order_discounts VALUES(SEQ_HEADER_ID.NEXTVAL,SEQ_LINE_ID.NEXTVAL,SEQ_DISCOUNT_ID.NEXTVAL,V_DISC_NAME,V_TOTAL_DISC_AMT);
END IF;
IF V_NET_PRICE>p_orderdetails(i).REQUESTED_PRICE THEN
INSERT INTO XXCTS_ORDER_DETAILS VALUES(SEQ_HEADER_ID.NEXTVAL,SEQ_LINE_ID.NEXTVAL,V_CUST_ID,V_PROD_ID,p_orderdetails(i).QUANTITY,p_orderdetails(i).REQUESTED_SHIP_DATE,p_orderdetails(i).REQUESTED_PRICE,V_LIST_PRICE,V_TOTAL_DISC,V_NET_PRICE,V_EXTN_PRICE,'PRICE HOLD','NET PRICE CANNOT BE MORE THAN REQ PRICE',SYSDATE);
INSERT INTO xxcts_order_discounts VALUES(SEQ_HEADER_ID.NEXTVAL,SEQ_LINE_ID.NEXTVAL,SEQ_DISCOUNT_ID.NEXTVAL,V_DISC_NAME,V_TOTAL_DISC_AMT);
END IF;
/* IF V_LIMIT<p_orderdetails(i).REQUESTED_PRICE THEN
INSERT INTO XXCTS_ORDER_DETAILS VALUES(SEQ_HEADER_ID.NEXTVAL,SEQ_LINE_ID.NEXTVAL,V_CUST_ID,V_PROD_ID,p_orderdetails(i).QUANTITY,p_orderdetails(i).REQUESTED_SHIP_DATE,p_orderdetails(i).REQUESTED_PRICE,V_LIST_PRICE,V_TOTAL_DISC,V_NET_PRICE,V_EXTN_PRICE,'ORDER LIMIT HOLD','PRICE CANNOT EXCEED ORDER LIMIT',SYSDATE);
INSERT INTO xxcts_order_discounts VALUES(SEQ_HEADER_ID.NEXTVAL,SEQ_LINE_ID.NEXTVAL,SEQ_DISCOUNT_ID.NEXTVAL,V_DISC_NAME,V_TOTAL_DISC_AMT);
END IF;*/
EXCEPTION
WHEN NO_DATA_FOUND THEN
DBMS_OUTPUT.PUT_LINE(' INSIDE EXCEPTION BLOCK');
END;
END LOOP;
END;
end conv_api_pkg;
/the pl/sql block to invoke the the procedure :
declare
begin
PROC_CONVERSION_API('/usr/tmp' ,'Walmart_Orders_062908.dat');
end;please let me know what is wrong in the program.
Thanks
AnveshHi Walter
Yes 'Inside begin 1' and 'Inside begin 2' were printed.Please find the the DBMS_OUTPUT statements that were printed.
Inside begin 1
Inside begin 1.1
Inside begin 2
Inside begin 2.1
the buffer is BESTBUY SONY ERICSSON W580i 25 1-AUG-2008 50
the length of buffer is 118
Customer Name is BESTBUY
Manufacturer is SONY ERICSSON
Product Name is W580i
Quantity is 25
Requested Ship Date is 01-AUG-08
The requested price is 50
The quantity is 25
The Customer count is 1
The Product count is 0
PRODUCT SHOULD BE VALID
Inside begin 2
Inside begin 2.1
the buffer is BESTBUY SAMSUNG BLACKJACK 50 15-JUL-2008 150
the length of buffer is 119
Customer Name is BESTBUY
Manufacturer is SAMSUNG
Product Name is BLACKJACK
Quantity is 50
Requested Ship Date is 15-JUL-08
The requested price is 150
The quantity is 50
The Customer count is 1
The Product count is 1
Inside begin 2
Inside begin 2.1
the buffer is BESTBUY APPLE IPHONE 4GB 50 15-JUL-2008
the length of buffer is 116
Customer Name is BESTBUY
Manufacturer is APPLE
Product Name is IPHONE 4GB
Quantity is 50
Requested Ship Date is 15-JUL-08
The requested price is 0
The quantity is 50
The Customer count is 1
The Product count is 1
Inside begin 2
Inside begin 2.1
the buffer is BESTBUY ATT TILT 100 15-JUN-2008
the length of buffer is 116
Customer Name is BESTBUY
Manufacturer is ATT
Product Name is TILT
Quantity is 100
Requested Ship Date is 15-JUN-08
The requested price is 0
The quantity is 100
The Customer count is 1
The Product count is 1
Inside begin 2
Inside begin 2.1
the buffer is BESTBUY NOKIA N73 50 15-JUL-2008 200
the length of buffer is 118
Customer Name is BESTBUY
Manufacturer is NOKIA
Product Name is N73
Quantity is 50
Requested Ship Date is 15-JUL-08
The requested price is 20
The quantity is 50
The Customer count is 1
The Product count is 0
PRODUCT SHOULD BE VALID
Inside begin 2In the first procedure I am trying to read the data from a flat file and store it in a table.Here is the sample data from the flat file.
BESTBUY SONY ERICSSON W580i 25 1-AUG-2008 50
BESTBUY SAMSUNG BLACKJACK 50 15-JUL-2008 150
BESTBUY APPLE IPHONE 4GB 50 15-JUL-2008
BESTBUY ATT TILT 100 15-JUN-2008
BESTBUY NOKIA N73 50 15-JUL-2008 200When tried to execute the second procedure independently using the PL/SQL block,the tables in second procedure were populated and the DBMS_Output statements were also displayed.I have made use of the same query in that case
Thanks
Anvesh
Edited by: Anvesh Reddy on Dec 23, 2008 12:40 PM -
How to call one procedure from another procedure
Hi all,
Could anyone give me clue how to call a procedure contains out parameters
from another procedure.
I had following procedures.
1)
create or replace procedure INS_PUR_ORDER
p_poamt in number,
p_podate in date,
p_poid out number
is
begin
select pkseq.nextval into p_poid from dual;
insert into pur_order(poamt,podate,poid)
values (p_poamt,p_podate,p_poid);
end;
2)
create or replace procedure INS_PUR_ORDER_DETAIL
p_pounits in number,
p_poddate in date,
p_poid in number)
is
begin
Insert into pur_order_detail(podid,pounits,poddate,poid)
values(pdseq.nextval,p_pounits,p_poddate,p_poid);
end;
I need to write a 3rd procedure which calls above two procedures.
like
call first procedure ,basing on the return value
i.e if p_poid != 0 then
we need to call second procedure
in the loop.
thanks in advance.
rampa.Not sure what are you doing, you can not assign cursor to another cursor, may be you are looking for this?
SQL> create or replace procedure proc1 ( result out sys_refcursor)
2 is
3
4 begin
5 open result for
6 select 'HELLO WORLD' from dual ;
7 end proc1 ;
8 /
Procedure created.
Elapsed: 00:00:00.01
SQL> create or replace procedure proc2
2 is
3 l_cursor sys_refcursor ;
4 begin
5 l_cursor := proc1 ;
6
7
8 open l_cursor;
9 fetch l_cursor into l_text;
10 dbms_output.put_line(l_text);
11 close l_cursor;
12
13
14 end proc2 ;
15 /
Warning: Procedure created with compilation errors.
Elapsed: 00:00:00.01
SQL> show error;
Errors for PROCEDURE PROC2:
LINE/COL ERROR
5/4 PL/SQL: Statement ignored
5/16 PLS-00306: wrong number or types of arguments
in call to 'PROC1'
6/4 PLS-00201: identifier 'L_TEXT' must be
declared
6/4 PL/SQL: Statement ignored
8/4 PLS-00382: expression is of wrong type
8/4 PL/SQL: SQL Statement ignored
9/4 PL/SQL: SQL Statement ignored
9/24 PLS-00201: identifier 'L_TEXT' must be
declared
10/4 PL/SQL: Statement ignored
10/25 PLS-00201: identifier 'L_TEXT' must be
declared
---- this is the correct waySQL>ed
1 create or replace procedure proc2
2 is
3 l_cursor sys_refcursor ;
4 l_text varchar2(100);
5 begin
---- procedure call
6 proc1(l_cursor);
7 -- open l_cursor;
8 fetch l_cursor into l_text;
9 dbms_output.put_line(l_text);
10 close l_cursor;
11* end proc2 ;
SQL> /
Procedure created.
Elapsed: 00:00:00.01
SQL> set serveroutput on
SQL> execute proc2;
HELLO WORLD
PL/SQL procedure successfully completed.
Elapsed: 00:00:00.00
SQL> -
Call procedure from another procedure
Hi All,
I have a requirement to call a procedure from another procedure and don't want to return to the main procedure again.please suggest me how to achive this .
thanksuser13424229 wrote:
I have a requirement to call a procedure from another procedure and don't want to return to the main procedure again.please suggest me how to achive this .A very strange requirement.. that perhaps you should expand on in order to get proper technical input and advice from forum members.
Assuming a valid requirement, it should be implemented in the following way:
SQL> create or replace procedure ProcB is
2 begin
3 DBMS_OUTPUT.put_line( 'ProcB(): executing...' );
4 end;
5 /
Procedure created.
SQL>
SQL>
SQL>
SQL> create or replace procedure ProcA is
2 E_CEASE_PROCESSING exception;
3 pragma exception_init(E_CEASE_PROCESSING, -20000 );
4 begin
5 DBMS_OUTPUT.put_line( 'ProcA(): executing...' );
6 DBMS_OUTPUT.put_line( 'ProcA(): doing stuff 1...' );
7 raise E_CEASE_PROCESSING; --// typically a conditional instruction
8 DBMS_OUTPUT.put_line( 'ProcA(): doing stuff 2...' );
9
10 exception when E_CEASE_PROCESSING then
11 ProcB;
12 end;
13 /
Procedure created.
SQL>
SQL>
SQL> exec ProcA
ProcA(): executing...
ProcA(): doing stuff 1...
ProcB(): executing...
PL/SQL procedure successfully completed.
SQL> -
Calling java classes from plsql procedures
I'm attempting to call java classes from plsql procedures which will create cmsdk users, folders, groups etc, however when I attempt to load a java class into the oracle schema using the command:
loadjava -user user/password@database -resolve classname.class
It generates error messages to the effect that classes (cmsdk classes) required by the class cannot be found. The class is loaded and marked with the status "invalid". Is it therefore necessary for me to load the cmsdk packages into the schema?
Cheers
DavidUsing CMSDK Java API within the database has never been supported
(see Problems loading IFS's java class into database
When we needed to invoke CMSDK code from our PL/SQL code, we used one of two approaches:
(1) use advanced queues to send requests to an external Java program (the CMSDK code, running outside the database) and receive the results back (asynchronous choice); or
(2) make an HTTP request to a Java servlet (the CMSDK code, running in some Java web container like iAS) and get the response back in some custom format (XML or something) (synchronous choice).
It seems to me that the CMSDK Java API was designed to be used only in middle-tier, not in database tier.
Regards,
Daniel. -
How to call a servlet from another servlet
hi everybody,
i have a problem, i have to call one servlet from another one.
Everything works on my pc, but when i install the application on the customer's server i got an error about an Uknown URL followed by the name of the machine.
Wjat i do is the folloqing :
String urlString = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+"/"+servletName;
URL url = new URL(urlString);
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
the variable servletName is the name of the servlet i have to call.
Is there another way to call the servlet ?
All the servlet are installed in the same server.
Any suggestion ?
Cheers.
StefanoSweep is correct about requestDispatcher being another approach for inter-servlet delegation; the only issue that i recall with this approach is that it defaults the method of the destination servlet to the one it was called from...for example, calling servlet2 from within servlet1.post() resulted in the dispatcher attempting to utilize servlet2.post() - i believe that i searched for a parameterize solution to no avail :( (ended up handling the request by placing a "fake" doPost() in servlet2 that simply called servlet2.doGet())
however, if your application is functioning correctly on your pc/webserver then the problem may be external to servlet communication (e.g. client webserver's ports not configured or blocked, missing runtime classes, etc.)
my suggestion would be to set aside the programmatic concerns for the moment - what is the response if you open a browser on a client's machine and access the URL in question (i.e. http://clientserver:port/stefanoServlet)? If it will not respond to access in this manner then it certainly won't when your application calls for it.
It's possible that there is a coding error but, given the info supplied, i'd start examining the environment, first. Let us know if you have any luck with the test i recommended or not (please provide abundant detail). Or, if you've found the solution then you may want to post back with a quick blub so the next person knows how to escape the trap.
D -
Calling a report from another report
Hi,
Is there any way ,(any built in ) to call a report from another report in Report Builder 2000 and Report Builder 6i.
RegardsTry to call report from report by a button in the calling report:
1 In the Layout Model view, click in the tool palette. Note
2 Click and drag a rectangle.
3 Double-click the button object to display the Property Palette.
4 Under the Button Label node, set the Label Type property to either Text or Icon:
n If the button label is text, set the Text property to the text you want to appear on the button.
n If the button label is an icon, set the Icon Name property to the name of the file containing the icon (the file must reside in the directory specified by the UI_ICON environment variable).
5 Under the Button Behavior node, set the Type property to PL/SQL.
6 Double-click the PL/SQL Trigger property value field.
7 In the PL/SQL Editor, define the PL/SQL for the action trigger or format trigger when the button is clicked in the formatted report.
8 Set other properties as desired.
9 To activate the button, run the report, then display it in the Runtime Previewer. -
Calling a Report from another Report.....URGENT
Hi,
I am calling a report from another report using hyperlink. I want that this new report should come in a new page.
Can any body help me where i can set this property, so that the new report will open in a new page.
Thanks in advance
Regards
KamalTry to call report from report by a button in the calling report:
1 In the Layout Model view, click in the tool palette. Note
2 Click and drag a rectangle.
3 Double-click the button object to display the Property Palette.
4 Under the Button Label node, set the Label Type property to either Text or Icon:
n If the button label is text, set the Text property to the text you want to appear on the button.
n If the button label is an icon, set the Icon Name property to the name of the file containing the icon (the file must reside in the directory specified by the UI_ICON environment variable).
5 Under the Button Behavior node, set the Type property to PL/SQL.
6 Double-click the PL/SQL Trigger property value field.
7 In the PL/SQL Editor, define the PL/SQL for the action trigger or format trigger when the button is clicked in the formatted report.
8 Set other properties as desired.
9 To activate the button, run the report, then display it in the Runtime Previewer. -
How to call one .SWF from another?
How do I call one .SWF from another. I built a very beefy
base .SWF, and want to add music overlay, and an intro slide show
to the exsting Flash animation, but put it in a second .FLA/.SWF
file. How do I call one from the other?
This will be embedded in an HTML file but I assume this is
superfluous to my question.
F.Z.I think you should open that Another SWF (FLA),
and add some actionscript..
For example, you could create a movie clip, and write
actionscript in the
first keyframe:
loadMovie("
http://www.somewebpage.com/movie.swf",
this);
"FredZimmerman" <[email protected]> wrote in
message
news:ftnjas$mj5$[email protected]..
> How do I call one .SWF from another. I built a very
beefy base .SWF, and
> want
> to add music overlay, and an intro slide show to the
exsting Flash
> animation,
> but put it in a second .FLA/.SWF file. How do I call one
from the other?
>
> This will be embedded in an HTML file but I assume this
is superfluous to
> my
> question.
>
> F.Z.
> -
Problem regarding calling a program from another program
Hi,
I have a requirement that i need to call a program from another program and in that case the called program should be executed with a value in the selection screen coming from the first program..i.e.
a standard report to view the user Notes for annual leave is RPTARQDBVIEW. Can we create a report to display all the users under a manager as a hyperlink and run the report(RPTARQDBVIEW), with the pernr of the employee selected
Regards,
saumikSubmitting a report using ranges for select-options
* Define range for ltak-tanum
RANGES: r_tanum FOR ltak-tanum.
* Read values from database tabel into the range
* These values are later used for select-options in the report
SELECT * FROM ltak
WHERE lgnum = w_lgnum AND "Warehouse number/complex
vbeln = w_screen1000-io_vbeln. "Transfer order number
MOVE ltak-tanum TO r_tanum-low.
MOVE 'I' TO r_tanum-sign.
MOVE 'EQ' TO r_tanum-option.
APPEND r_tanum.
ENDSELECT.
* Submit report with range
SUBMIT zmm00100 WITH p_tanum IN r_tanum.
or
Submitting a report from ABAP with selection criterias
TYPES: tt_selection TYPE STANDARD TABLE OF rsparams.
DATA: l_iblnr TYPE st_iblnr,
* Define internal table and work area for select-options
l_selection TYPE rsparams,
li_selection TYPE tt_selection.
* Create selectIon table
LOOP AT gi_iblnr INTO l_iblnr.
CLEAR l_selection.
l_selection-selname = 'IM_IBLNR'. "Option name
l_selection-kind = 'S'. "S= select options P=Parameters
l_selection-sign = 'I'. "Sign
l_selection-option = 'EQ'. "Option
l_selection-low = l_iblnr-iblnr. "Value
APPEND l_selection TO li_selection.
ENDLOOP.
* Submit report
SUBMIT rm07idif WITH SELECTION-TABLE li_selection AND RETURN.
Regards,
Prabhudas -
Calling a method from another file
This is pretty basic stuff but i can't seem to get it right. I am calling a method from another file. The other file IS located in the same folder BUT when i compile i get errors
"cannot find symbol" <===referring to limit and sieve i believe.
The method name is "sieve" the file name is "PrimeSieve2008" and "limit" is the variable in brackets in the real method.
public static void main (String [] args) {
final int [] PRIMES;
int sieve = PrimeSieve2008.sieve(limit);
PRIMES = sieve(getValidInt());
for (int j = 0; j<PRIMES.length; j++) {
System.out.println("Prime[" + j + "] = " + PRIMES[j]);
Is "int sieve = PrimeSieve2008.sieve(limit)" the wrong way to call a file?
Thanks a million,
Alex
Edited by: Simplistic2099 on Apr 3, 2008 7:47 PM
Edited by: Simplistic2099 on Apr 3, 2008 7:49 PMSimplistic2099 wrote:
the other method runs fine:
"public static int[] sieve(final int limit){
int candidate; // possible prime
int count; // no. of primes found
boolean[] mayBePrime = new boolean[limit+1];
// remaining possibilities
final int[] PRIMES; // array to return
// initialize mayBePrime
for ( int j = 0 ; j <= limit ; j++ ) {
mayBePrime[j] = true;
mayBePrime[0] = mayBePrime[1] = false;
// apply sieve, and count primes
candidate = 2;
count = 0;
while ( candidate <= limit ) {
if ( mayBePrime[candidate] ) {
count++;
for ( int j = 2 * candidate ; j <= limit ; j += candidate ) {
mayBePrime[j] = false;
} // end for
} // end if
candidate++;
} // end while
// fill up new array with the primes found
PRIMES = new int[count];
count = 0;
for (int j = 2 ; j <= limit ; j++ ) {
if ( mayBePrime[j] ) {
PRIMES[count] = j;
count++;
} // end if
} // for
return PRIMES;
} // sieve
I really am clueless here.in this one you are passing in limit.
in the other one you are getting limit from somewhere outside of main. -
Calling a method from another class... that requires variables?
I'm calling a method from another class to change the date (its a date object) in another class.
I keep getting the error 'setDate(int,int,int) in Date cannot be applied to ()'
My code is:
public int changeDate()
cycleDate.setDate();
}I'm guessing I need to pass 3 parameters (day, month, year), but I'm not sure how! I have tried, but then I get errors such as ')' expected?
Any ideas! :Df1d wrote:
I'm calling a method from another class to change the date (its a date object) in another class.
I keep getting the error 'setDate(int,int,int) in Date cannot be applied to ()'
My code is:
public int changeDate()
cycleDate.setDate();
}I'm guessing I need to pass 3 parameters (day, month, year), seems that way from the error you posted
but I'm not sure how!
setDate(16, 6, 2008);
I have tried, but then I get errors such as ')' expected?
Any ideas! :Dyou need to post your code if you're getting specific errors like that.
but typically ')' expected means just that, you have too many or not enough parenthesis (or in the wrong place, etc.)
i.e. syntax error -
Help on Calling a method from another class
how can i call a method from another class.
Class A has 3 methods
i just want to call only one of these 3 methods into my another class.
How can I do that.When i am trying this
A a=new A;
Its calling all the methods from class A. I just want
to call a specfic method.How can it be done?When i am trying this
A a=new A();
Its calling all the methods from class A. I just want to call a specfic method.How can it be done? -
Calling repaint method from another class
My question in a very simple form :
how do I call repaint mathod from another class.
e.g: Let's say class "A.java" is a JFrame .
Class "B.java" is a JPanel which is added to the JFrame above.
Class "C.java" is a JDialog containing some JButtons.
How do I call the repaint method from the class "C.java".
Thank you in advance!!My question in a very simple form :
how do I call repaint mathod from another class.
e.g: Let's say class "A.java" is a JFrame .
Class "B.java" is a JPanel which is added to the JFrame above.
Class "C.java" is a JDialog containing some JButtons.
How do I call the repaint method from the class "C.java".
Thank you in advance!!
Maybe you are looking for
-
Since upgrading to Mountain Lion my computer crashes almost every night
In the morning I have to push the power button even though the sleep is set to never. It turns out that sometimes during the night and actually usually very close to the morning after there was a kernel panic. panic(cpu 0 caller 0xffffff801bc88aac):
-
I created the pdf form and extended user rights which allows the end user to fill the form in. However, if they press "Save" instead of "Save As" they overwrite the original pdf. How can I protect the pdf so they cannot overwrite it but they can us
-
I'm trying to use a central LDAP server (openLDAP) for all the machines in my house. My problem is in the mapping of AB entries and the corresponding LDAP attributes. It recognizes "telephoneNumber" in LDAP as "Work Phone" in Address Book. Also, "mob
-
Installing Final Cut HD 3.5
We have a computer lab with eMacs running Mac OS X 10.3.4 and 512 MB of RAM. We bought an academic volume license of Final Cut Express HD 3.5 and I have been trying to install it on the computers but a message saying that it is impossible to install
-
Precautions for Changing Currency Decimal Places
Hi Gurus, I am having a requirement to change currency decimal place, which is set wrong at the time of golive.I wanted to know what are the precautions i need to take for changing the currency decimal places. As per the note at the time of changing