How to break the output in a function
Hi All,
I am using oracle Db 10g
I have write a function to get the output of Expire date and pass this function to Alert in oracle.
My Function is Like this
create or replace
function Expiry_alert (P_EXPIRY_DATE date)
return VARCHAR2
IS
lv_return_value varchar2(10000);
cursor c_exp_alt
is
SELECT Distinct c_po_number,c_bg_type,c_guarantee_number,c_expiry_date,c_supplier_name
from xxbgs_bank_guarantee_master
WHERE TRUNC (TO_DATE (C_expiry_date) -15) = TRIM (SYSDATE)
and c_expiry_date= p_expiry_date;
BEGIN
for c_exp_alt_rec in c_exp_alt
loop
lv_return_value:= lv_return_Value||CHR(10)||'Bank Guarantee('||c_exp_alt_rec.C_guarantee_number||','||c_exp_alt_rec.C_BG_TYPE ||','||c_exp_alt_rec.C_po_number||','||c_exp_alt_rec.c_supplier_name ||')'||'is getting expired on'||'('||C_EXP_ALT_REC.C_EXPIRY_DATE||')'||;
end loop;
return(lv_return_value);
exception
when others then
null;
--dbms_output.put_line ('Error:'sqlerrm);
--return(lv_return_value);
END;
When i execute the function using select statement like this
SELECT distinct Expiry_alert(C_EXPIRY_DATE)
FROM xxbgs_bank_guarantee_master
WHERE TRUNC (TO_DATE (C_expiry_date)-15) =
TRIM (SYSDATE)
My output is like this
Bank Guarantee(100012,Parent Company Guarantee,1000,Advantage Corp)is getting expired on(02-MAR-12) Bank Guarantee(123890,Advance Bank Guarantee,1011,Office Supplies, Inc.)is getting expired on(02-MAR-12)
In a single line, But here i have two different Guarantee number so i need two records like this
Bank Guarantee(100012,Parent Company Guarantee,1000,Advantage Corp)is getting expired on(02-MAR-12)
Bank Guarantee(123890,Advance Bank Guarantee,1011,Office Supplies, Inc.)is getting expired on(02-MAR-12)
Can any one pls tell me how to change the function to achieve this.
Regards
Srikanth
Edited by: Srikkanth.M on Feb 16, 2012 4:41 PM
Srikkanth.M wrote:
Hi All,
I am using oracle Db 10g
I have write a function to get the output of Expire date and pass this function to Alert in oracle.
My Function is Like this
.. snip ..
exception
when others then
null;
Seriously? Your function contains an exception handler to mask any and all errors that may occur? WHY?
When i execute the function using select statement like this
SELECT distinct Expiry_alert(C_EXPIRY_DATE)
FROM xxbgs_bank_guarantee_master
WHERE TRUNC (TO_DATE (C_expiry_date)-15) =
TRIM (SYSDATE)
My output is like this
Bank Guarantee(100012,Parent Company Guarantee,1000,Advantage Corp)is getting expired on(02-MAR-12) Bank Guarantee(123890,Advance Bank Guarantee,1011,Office Supplies, Inc.)is getting expired on(02-MAR-12)
In a single line, But here i have two different Guarantee number so i need two records like this
Bank Guarantee(100012,Parent Company Guarantee,1000,Advantage Corp)is getting expired on(02-MAR-12)
Bank Guarantee(123890,Advance Bank Guarantee,1011,Office Supplies, Inc.)is getting expired on(02-MAR-12)
Can any one pls tell me how to change the function to achieve this.Sounds like you need a pipelined function to return multiple rows...
Basic example of pipelined function with multiple columns...
CREATE OR REPLACE TYPE myrec AS OBJECT
( col1 VARCHAR2(10),
col2 VARCHAR2(10)
CREATE OR REPLACE TYPE myrectable AS TABLE OF myrec
CREATE OR REPLACE FUNCTION pipedata(p_str IN VARCHAR2) RETURN myrectable PIPELINED IS
v_str VARCHAR2(4000) := REPLACE(REPLACE(p_str, '('),')');
v_obj myrec := myrec(NULL,NULL);
BEGIN
LOOP
EXIT WHEN v_str IS NULL;
v_obj.col1 := SUBSTR(v_str,1,INSTR(v_str,',')-1);
v_str := SUBSTR(v_str,INSTR(v_str,',')+1);
IF INSTR(v_str,',')>0 THEN
v_obj.col2 := SUBSTR(v_str,1,INSTR(v_str,',')-1);
v_str := SUBSTR(v_str,INSTR(v_str,',')+1);
ELSE
v_obj.col2 := v_str;
v_str := NULL;
END IF;
PIPE ROW (v_obj);
END LOOP;
RETURN;
END;
SQL> select *
2 from table(pipedata('(1,2),(3,4),(5,6)'));
COL1 COL2
1 2
3 4
5 6of course why you need to do this in a function in the first place? Can't you just query the data concatenated as you want it?
Similar Messages
-
How to assign the output of a function to a text area: a PLSQL challenge
I have a function that returns a PLSQL table of varchar4(4000)
Here is its signature in a package:
create or replace package researcher_request_pk
is
TYPE query_table_type is table of varchar2(4000) index by binary_integer;
FUNCTION RequestSQL(P_RRQ_ID in number) return query_table_type;
end;
I use this to get around the 32k limit on clobs and varchar2 variables
I want to assign the output of the function to a text area. I've tried the following PLSQL in a dynamic action and also as the source attribute of the Text Area but it doesn't populate the text area.
Here is the code i'm using
declare
v_table researcher_request_pk.query_table_type;
begin
v_table:=researcher_request_pk.RequestSQL(:P64_RRQ_ID);
for i in 1..v_table.count loop
htp.prn(v_table(i));
end loop;
end;
Any ideas on the correct syntax to do this?
thanks in advance
PaulPThanks for your reply
The function does populate the PLSQL table with data. e.g. If I place that exact code in a PLSQL region it generates the output on the screen with no problems. The problem is just generating the output into the text area.
I want the text area to display the output of the PLSQL table (-a dynamic select SQL statement) which I then plan to execute to return records.( i.e. I've build my own runtime query builder)
My plan is to allow the user to edit the SQL output first before sending the statement for execution.
Funnily enough I do get the very first word of the first cell appearing, namely 'SELECT' but nothing else. Maybe the "||" that follows has something to do with the rest of it not appearing?? hmmm... will experiment more.
thanks
PaulP -
How to get the output of my batch file or script file
Hello,
I am a beginner in java and I have to run a batch file(in win) or a script(in linux). I want the output of the file in my java program. How to read the output. I used the following code and it always gave me the empty string output
Runtime r = Runtime.getRuntime();
Process p = null;
p = r.exec("./test.bat"); //./test.sh
int res = p.waitFor();
BufferedReader br = new BufferedReader(new InputStreamReader(p.getInputStream()));
String tempStr = "", str = null;
while((str=br.readLine()) != null) {
tempStr += str + "\n";
System.out.println(tempStr);
I know this is a simple one but it's taking a lot of time. Can any one there help me quickly.hi
the below function works well for me..
just make a try with it
protected String runConsoleCommand(String command) throws IOException {
Process p = Runtime.getRuntime().exec(command);
InputStream stdoutStream = new BufferedInputStream(p.getInputStream());
StringBuffer buffer = new StringBuffer();
for (; ; ) {
int c = stdoutStream.read();
if (c == -1)
break;
buffer.append( (char) c);
String outputText = buffer.toString();
stdoutStream.close();
System.out.println("the output to file is:"+outputText);
return outputText; -
How to download the output of a report along with column header
Hi,
Could someone please tell me on how to download the output of a report along with column header to .txt format. A download option needs to be given to the user using physical and logical file names .The report basically contains header details and item details and requirement is to download the same format into an .txt format.Hello,
Try this FM:
Data: being of itab occurs 0,
matnr like mara-matnr,
maktx like makt-maktx,
end of itab.
data:begin of fld_tab occurs 0,
fld_name(20),
end of fld_tab.
fld_tab = 'Material'.
append fld_tab.
fld_tab = 'Material Desc'.
append fld_tab.
CALL FUNCTION 'WS_DOWNLOAD'
EXPORTING
BIN_FILESIZE = ' '
CODEPAGE = ' '
FILENAME = 'C:\1.txt '
FILETYPE = 'DAT'
MODE = ' '
WK1_N_FORMAT = ' '
WK1_N_SIZE = ' '
WK1_T_FORMAT = ' '
WK1_T_SIZE = ' '
COL_SELECT = ' '
COL_SELECTMASK = ' '
NO_AUTH_CHECK = ' '
IMPORTING
FILELENGTH =
TABLES
DATA_TAB = itab
FIELDNAMES = fld_tab
EXCEPTIONS
FILE_OPEN_ERROR = 1
FILE_WRITE_ERROR = 2
INVALID_FILESIZE = 3
INVALID_TYPE = 4
NO_BATCH = 5
UNKNOWN_ERROR = 6
INVALID_TABLE_WIDTH = 7
GUI_REFUSE_FILETRANSFER = 8
CUSTOMER_ERROR = 9
OTHERS = 10
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Regards,
Naimesh -
Storing the output of a function module into a custom table
Hi Gurus,
Is it possible to store the output of a function module into a custom table.How can this be done?Is it complex?hi,
After u execute the FM and get values in the internal table ITAB_RESULT. Create a custom table having structure same as ITAB_RESULT call it ZRESULT.
data :wa type ITAB_RESULT.
call FM and get result it ITAB_RESULT
loop at itab_result.
move-corresponding itab_result to wa.
insert wa to ZRESULT.
endloop.
Regards,
Mansi. -
How to store the output of a analog to digital converter into an 2D array
Hi
I am doing my M.Tech Thesis in Image reconstruction and I am using labview for simulation and I want to know how to store the output of a analog to digital converter into an 2D labview array.nitinkajay wrote:
I want to know how to store the output of a analog to digital converter into an 2D labview array.
How exactly are you performing 'Analog to Digital'???
Grabbing image using camera OR performing data acquisition using DAQ card OR some other way????
I am not allergic to Kudos, in fact I love Kudos.
Make your LabVIEW experience more CONVENIENT. -
How to use the Output clause for the updated statment
How to use the output clause for the below update stament,
DECLARE @MyTableVar table(
sname int NOT NULL)
update A set stat ='USED'
from (select top 1 * from #A
where stat='AVAILABLE' order by sno)A
Output inserted.sname
INTO @MyTableVar;
SELECT sname
FROM @MyTableVar;
Here am getting one error incorrect syntax near Output
i want to return the updated value from output clausesee
http://blogs.msdn.com/b/sqltips/archive/2005/06/13/output-clause.aspx
Please Mark This As Answer if it solved your issue
Please Vote This As Helpful if it helps to solve your issue
Visakh
My Wiki User Page
My MSDN Page
My Personal Blog
My Facebook Page -
How to change the output as text format in Apps R12.1.3
Hi All,
Currently iam trying to modify the Java Concurrent Program (FDExtractAndFormatting) in Batch Payment Process. This Program is generated in text format in 11i APPS. Now we are upgrading to R12.1.3. In R12.1.3 output is coming as PDF format. Here my requirement is how to change the output as text format in R12.1.3 also.
Please do the needful and suggest me.
Regards,
Jagadeesh1. It is seeded java concurrent program. Some attributes are missing from 11i to R12. In 11i it is a text format.So i have to investgate on how to retrive those attributes in R12. What is the concurrent program name?
Have you tried to change the output and submit the request?
2. Once all are attributes are coming in PDF format. Client wants to open same output in text format as it is 11i (In R12 it is generated in PDF format).If the above does not help, please log a SR.
Thanks,
Hussein -
How to remove the rule or class function in CS5
i need to know how to remove the rule or class function in CS5 at the bottom of the screen there are two options for formating HTML and Css when i click the HTML it only allows me to change the bold or italics or link something but when i click CSS it allows me to format how i want the paragraph aligned and the text size and font when i click on lets say changing the font size a box comes up asking me to name a rule so it applies it to everything else i type i want to know how to stop tht like edit everything on my own and if i use CS5 here will it be compatible with CS4 or CS3 at my skool plzz help ive been frustrated with this
If I use CS5 here will it be compatible with CS4 or CS3 at my skool plzz help ive been frustrated with this
Code is code. It doesn't matter which product you use.
i need to know how to remove the rule or class function in CS5
You can't. DW encourages you to use good coding methods, which means using CSS classes and to keep content (HTML) separate from styles (CSS). For example, if you change font-size on p tags like so:
p {font-size: 38px}
Every paragraph will have 38px sized text.
If you want to apply a special style to just a portion of your text, you must define a CSS class name like so:
.foo {
font-size: 38px;
color: red;
HTML:
<p>This is normal paragraph text <span class="foo"> And this is very big and red.</span></p>
This is normal paragraph text And this is very big and red.
Nancy O.
Alt-Web Design & Publishing
Web | Graphics | Print | Media Specialists
http://alt-web.com/
http://twitter.com/altweb
Message was edited by: Nancy O. -- unfortunately, this forum doesn't support Raw HTML with inline styles. You'll need to paste my code examples into your DW page to see the effect. -
How to download the output of two reports in WebTemplate into excel sheet?
How to download the output of webtemplate which consists of two reports in one Web Template into same Excel sheet?
hi sunil,
here is the HTML code for 'export to excel'
<!-- Display Export Excel--->
<td class="SAPBEXNavLine"> <SAP_BW_TEXT program="SAPLRRSV" key="T72">" src="Mime/BEx/Icons/S_X_XLS.gif" border=0 ></td>
you can also use BEx download scheduler to download the precalculated webtemplate report to excel sheet.
Check the link below.
https://websmp104.sap-ag.de/~form/sapnet?_FRAME=CONTAINER&_OBJECT=011000358700000401962004E
i think this will help u
regards,
sindhu. -
How to send the output to PDF format in reports 6i?
Hi,
How to send the output to PDF format in reports 6i? I given Mode = BITMAP.
DESTYPE = File, DESFORMAT = PDF, DESNAME = C:\x.pdf.
Report is running fine. But PDF file not generated. I don't know what i missed. Any one can help this?
Thanks
KavithaHello,
Do you get this problem only for DESFORMAT=PDF ?
Test with :
DESFORMAT = RTF, DESNAME = C:\x.rtf
or
DESFORMAT = HTMLCSS, DESNAME = C:\x.html
does it work ?
Check if DESNAME is modified in the reports itself.
Regards -
How to get the output of the report in pdf format
how to get the output of the report in pdf format?
Thanks in advance,
madan.Refer these links
http://www.sap-img.com/bc037.htm
http://www.members.tripod.com/abap4/Save_Report_Output_to_a_PDF_File.html
CONVERT_ABAPSPOOLJOB_2_PDF FM convert abap spool output to PDF -
How to get the output of Standard HR forms in PE51
Hi Experts,
How to get the output of standard HR forms available in PE51 Transaction for coutry grouping 99.
Please advice.
Regards,
IFFHi
Use the t code for country grouping 99....PC00_M99_CEDT - Remuneration Statement. to get the variant in tcode PC00_M99_CALC_SIMU - Simulation.
Like this test for all the standard forms, what all are the available in PE51 for country grouping 99 -
How to save the output of sap script to pdf document in sap
hi abapers
how to save the output of sap script in sap so that can retrieve the saved document later.
i have to save the rcia output from sap script in pdf document in sap so that it can be retrieved later
how to use dmsHi deepika,
This thread will solve ur problem OTF -> PDF
Regards,
Pravin -
How to change the output directory of .xml files
Hi,
There are lots of .xml files generated under
$ORACLE_AS_HOME/j2ee/home/applications/xmlpserver/xmlpserver/xml.
(ex:/usb/bipub3/oracle/oc4j_bi/j2ee/home/applications/xmlpserver/xmlpserver/xml).
I found these files are generated in the following operation;
1.Log in BI Publisher.
2.Select the Schedules tab.
I think they are kind of temp files so we will be able to delete them.
But I'd like to know how to change the output directory.
Can we change the above directory to other path?
Regards.Why? As that may invalidate support since you configure/alter the deployment.
The location is specified in oc4j_bi\j2ee\home\applications\xmlpserver\xmlpserver.war, so you could go into the war file and alter it.
Maybe you are looking for
-
Tabbed panel dosen't work in IE
I need to fix this in IE so that it woks, please review my site at http://www.jobclub.com and let me know what to do
-
hi I have faced a problem in the field QUOTATION length whose maiximum length is 10 chars only.I want to have more than 10 chars ( nearly 40 chars) to enter. Table name : RM06E Field : ANFNR pl. respod soon Thanks in advance.
-
We have XSCF on a host, configured for SSH. Solaris 10 (5.10) M3000 A few days ago we went to login ... $ ssh admin@[redacted] ssh_exchange_identification: Connection closed by remote host $ Seems ... SSH is hung on the device? It is open ... $ nmap
-
Read and Write from Remote Shared directory
Hello everyone, I'm working on an enterprise portal. One of the things i was asked to do is access a remote directory (like "\\machine\share\") and be able to, at least, list the files, download to the portal user any of them, and be able to upload s
-
Hi experts, I am deploying a new WSA, but seem unable to upgrade AsyncOS - when I check for available upgrades, I receive the following error: Error Failure downloading upgrade list. Everything else seems to be OK - I have time via the default NTP se