Sorting a varchar2 field in Report 10g
Dear all,
i have a table of salaries, which have a field RANK_NO VARACHAR2.
I create a report and order it by RANK_NO. but it is not ordering what i want to be. it is ordered like
1
10
11
2
3
4
5
6
7
8
9
then i use the order by cluase like this,
ORDER BY TO_NUMBER(REGEXP_SUBSTR(RANK_NO,'[0-9]+')),
REGEXP_SUBSTR(UPPER(RANK_NO),'[A-Z]+').
but the result is same .
how to sort a varchar2 field in reports?
Thanks & Regards
Hi Muhammad,
Use the following Order By clause hope it helps you,
ORDER BY TO_NUMBER (REPLACE (RANK_NO, LTRIM (RANK_NO, '0123456789'))), RANK_NO
Best Regards
Arif Khadas
Similar Messages
-
Discoverer 2000 : Problem in sorting date field on report
Hello,
I am not able to sort on date field on report
it is giving error as
( illegal operation).Thanks Savitha.
I found one more way of making that code work, just want to share this.
If we add the following statement, the same code works without having to add the time part along with date.
"DBMS_XMLSave.setdateformat(updctx, 'yyyy-MM-dd');"
note the format is case sensitive. Instead of MM, if you give 'mm' it won't work, it uses java format. -
How can we sort up currency field in alv grid??
Hi GUrus,
Can any one suggest me how to sort the currency field in alv grid...Please help me out of this issue..
Thanks in advance!!!
regards,
Kranthi.hii,
SAP provides a set of ALV (ABAP List Viewer) & function modules, which can be used to enhance the readability and functionality of any report output.
ALV is a flexible tool used for displaying lists.The tool provides common list functions & can be enhanced by self-defined options.
so u will get the option for sorting in your alv report.
Thanks -
Formula Columns are not working in Reports 10g
Hi,
We converted the reports developed in Reports 6i to Reports 10g. When we run the report in Reports 10g Builder everything works fine. But when we deploy the same report in Oracle Application Server and invoking the report the formula columns are not working ie., the fields/ placeholder columns which are based on the formula column are not displaying any values in the report.
Please, someone help us in this regard.
Thanks & Rgds,
M TWhat version of Reports do you use..???
Greetings... -
Issue with Oracle Report 10g output
I want to generate text output in Oracle Reports 10g. I am using paper layout.Length of the fields want to print is 750. Each line is broken in the output after 120 characters length apporx. Please let me know if there is any way to print complete 750 characters.
Sample output is coming as below :
T2013 56600084112345 FPWC
955 OLD WILMINGTON RD FAYETTEVILLE
CUMBERLAND NC28301 00000001CONTACT TESING 1234567890
00000001 I'
I want it to be discplayed in single line instead of breaking. -
How to call a Report 10g from a parameter form..?
Hello,
pls i wanna know the procedure of :
How to call a Report 10g from a parameter form..?
regards,
Abdetu..hopes it work for you.
procedure get_report is
pl_id paramlist;
p_year varchar2(4);
param_name varchar2(10) :'param';
begin
pl_id := get_parameter_list(param_name);
if not id_null(pl_id_)then
destroy_parameter_list(pl_id);
end if;
pl_id := create_parameter_list(param_name);
p_year := year -- assign the value.
add_parameter(pl_id,'p_year',text_parameter,p_year);
execute_report('report_name',pl_id);
end; -
Error when useing DBMS_CRYPTO package in reports 10g
hi all,
i wrote a package which use dbms_crypto, there are functions to crypto userid and decrypo userid.
in report 6i it work fine it cryptos and decrpts. when i use in reports 10g it gives this error.
-28817 ORA-28817: PL/SQL function returned an error.
ora-06512: at "SYS.DBMS_CRYPTO_FFI", line 67
ORA-06512: at "SYS.DBMS_CRYPTO", line 41
ora-06512: at "YBS.SIFRELE", line 26
the packege like this;
PACKAGE BODY SIFRELE
IS
function sicil_sifrele (p_sicil_no IN varchar2) RETURN varchar2
IS
p_key RAW(128);
p_sicil_raw RAW(128);
p_encrypted_raw RAW(128);
BEGIN
p_key := utl_raw.cast_to_raw(to_char(sysdate,'mmyyyydd'));
p_sicil_raw := utl_raw.cast_to_raw(p_sicil_no);
p_encrypted_raw := dbms_crypto.encrypt(src => p_sicil_raw,
typ => dbms_crypto.des_cbc_pkcs5, key => p_key);
return (utl_raw.cast_to_varchar2(p_encrypted_raw));
END;
FUNCTION sicil_coz ( p_encrypted_raw IN RAW) RETURN varchar2
IS
p_key RAW(128);
p_decrypted_raw RAW(128);
sicil_donen VARCHAR2(250);
BEGIN
p_key := utl_raw.cast_to_raw(to_char(sysdate,'mmyyyydd'));
p_decrypted_raw := dbms_crypto.decrypt(src => p_encrypted_raw,
typ => dbms_crypto.des_cbc_pkcs5, key => p_key);
sicil_donen := utl_raw.cast_to_varchar2(p_decrypted_raw);
return (sicil_donen);
END;
END;
thanks.
eserHello,
You should create a "wrapper function"
Create a function in the database that will call dbms_crypto.encrypt / dbms_crypto.decrypt and call this function in Reports.
(The problem here seems to be the reference to dbms_crypto.des_cbc_pkcs5)
Regards -
Error when using DBMS_CRYPTO package in reports 10g
hi all,
i wrote a package which use dbms_crypto, there are functions to crypto userid and decrypo userid.
the packege like this;
PACKAGE BODY SIFRELE
IS
function sicil_sifrele (p_sicil_no IN varchar2) RETURN varchar2
IS
p_key RAW(128);
p_sicil_raw RAW(128);
p_encrypted_raw RAW(128);
BEGIN
p_key := utl_raw.cast_to_raw(to_char(sysdate,'mmyyyydd'));
p_sicil_raw := utl_raw.cast_to_raw(p_sicil_no);
p_encrypted_raw := dbms_crypto.encrypt(src => p_sicil_raw,
typ => dbms_crypto.des_cbc_pkcs5, key => p_key);
return (utl_raw.cast_to_varchar2(p_encrypted_raw));
END;
FUNCTION sicil_coz ( p_encrypted_raw IN RAW) RETURN varchar2
IS
p_key RAW(128);
p_decrypted_raw RAW(128);
sicil_donen VARCHAR2(250);
BEGIN
p_key := utl_raw.cast_to_raw(to_char(sysdate,'mmyyyydd'));
p_decrypted_raw := dbms_crypto.decrypt(src => p_encrypted_raw,
typ => dbms_crypto.des_cbc_pkcs5, key => p_key);
sicil_donen := utl_raw.cast_to_varchar2(p_decrypted_raw);
return (sicil_donen);
END;
END;
in report 6i it work fine cryptos and decrpts. when i use in reports 10g it gives this error.
-28817 ORA-28817: PL/SQL function returned an error.
ora-06512: at "SYS.DBMS_CRYPTO_FFI", line 67
ORA-06512: at "SYS.DBMS_CRYPTO", line 41
ora-06512: at "YBS.SIFRELE", line 26
thanks...Hello,
You should create a "wrapper function"
Create a function in the database that will call dbms_crypto.encrypt / dbms_crypto.decrypt and call this function in Reports.
(The problem here seems to be the reference to dbms_crypto.des_cbc_pkcs5)
Regards -
Hi Gurus,
I am using an Boilerplate in the Reports 10g. In the Property Inspection I am passing
Source File Format : Image
Source FileName : &P_IMG_LOCATION
Where &P_IMG_LOCATION is the dynamic location which is fetched from the database
For Eg . &P_IMG_LOCATION will be \\oracle\logo.bmp
But It is giving accepting &P_IMG_LOCATION in the Source FileName.
Please tell me how can i pass the location???
Best Regards,Yeah, you can't do that. Instead, in your data model, create a formula column that is populated from &p_img_location. Then, set the "Read from File" property to "Yes" and the "File Format" to "Image". In your layout, create a new field and use the new formula column as the source.
Message was edited by:
Brian Hill -
Re: Barcode in Reports 10g
I know this is an old post,
Barcode in Reports 10g
but I am facing the same problem here. Using reports 11.1.2.1, running on a Linux server.
I have set this on <domain>config/FRComponent/frcommon/guicommon/tk/admin/uifont.ali:
XYZFONT = "XYZFONT.afm XYZFONT.pfa"
But generated PDF reports are not embedding the fonts, since I need to have them installed on the computer to see the barcode. I understand the parameter PDFEMBED is set to true by default. But my reports are called from Oracle Forms. How can I be sure the parameter is correct? What else could I check?
Thanks in advance.Hello,
The steps related to PDF Subsetting and PDF embedding are "extra" steps that occur after the step "Report formatting ".
In order to take into account the line :
XYZFONT = "XYZFONT.afm XYZFONT.pfa"
the font used during the step "Report formatting " must be XYZFONT .
Did you test to generate the Report with DESFORMAT=HTML ?
Check in the HTML output the font name used for the "Barcode Field".
For more details , you can refer to the document :
Troubleshooting Guide for Font Aliasing / Font Subsetting / Font Embedding Issues (Doc ID 350971.1)
Kind regards -
Problem with 'order by' and comparison operator with varchar2 field
I have a problem with the following sql query (field1 is varchar2):
SELECT field1
FROM tablename
WHERE field1 > 'AA10BB'
ORDER BY field1
The contents of field1 is:
AA10BB
AA10-10BB
AA10-12BB
The sql query without the WHERE clause sorts field1 this way:
AA10BB
AA10-10BB
AA10-12BB
But the sql query with the WHERE clause has no hits.
It seems that when sorting the minus character is greater than the 'B' character and
at the comparison ( > 'AA10BB' ) the minus character is lower than the 'B' character!
The database and client NLS_PARAMTER are GERMAN_GERMANY.
The database is 9.2.0.7
Has anyone an idea?thanks for your fast reply!
My problem was that NLS_SORT was set to 'GERMAN' and NLS_COMP to 'BINARY'.
NLS_SORT = GERMAN orders the varchar2 fields in form of 'a A b B ... 0 1 2 3 ..'
NLS_COMP = BINARY compares binary (ASCII-Table).
I use now:
SELECT field1
FROM tablename
WHERE field1 > 'AA10BB'
ORDER BY NLSSORT(field1, 'NLS_SORT = Binary''); -
Convert varchar2 field into date formatted: DD-MON-YYYY
Thanks in advance for anyone's help on this matter as I know it takes your time and expertise. I am pretty new to SQL but learning my way through it just have an issue with a text to date field conversion. It is an Oracle 10g database and I am writing in SQL. There is a field called Demand which is formatted in varchar2 format of ddmmyy. There is also a field that is formatted as a date called Payment which is formatted as DD-MON-YYYY.
Essentially I need to do a simple Payment >= Demand, however as you can see that is some issue with that being a varchar2 field. Does anyone know if it is possible to do that type of expression against those two fields. Was thinking about possibly converting the varchar2 to a date but not sure how to get to that DD-MON-YYYY format.
Also there are situations where this Demand field will often times be null as it would have never recieved any outbound correspondence in the past and would not have a date at all.
Thanks
Edited by: user10860766 on Aug 18, 2009 8:14 AM
Edited by: user10860766 on Aug 18, 2009 8:19 AMHi,
It's hard to detect bad dates in pure SQL, especially if you need to be precise about when February 29 is valid.
It's easy with a user-define function, like the one in [this thread|http://forums.oracle.com/forums/thread.jspa?messageID=3669932�].
Edited by: Frank Kulash on Aug 18, 2009 3:50 PM
To create a stand-alone function:
CREATE OR REPLACE FUNCTION to_dt
( in_txt IN VARCHAR2 -- to be converted
, in_fmt_txt IN VARCHAR2 DEFAULT 'DD-MON-YYYY' -- optional format
, in_err_dt IN DATE DEFAULT NULL
RETURN DATE
DETERMINISTIC
AS
BEGIN
-- Try to convert in_txt to a DATE. If it works, fine.
RETURN TO_DATE (in_txt, in_fmt_txt);
EXCEPTION -- If TO_DATE caused an error, then this is not a valid DATE: return in_err_dt
WHEN OTHERS
THEN
RETURN in_err_dt;
END to_dt
/To use it:
SELECT primary_key -- and/or other columns to identify the row
, demand
FROM table_x
WHERE demand IS NOT NULL
AND to_dt ( demand
, 'DDMMYY'
) IS NULL; -
ORacle reports 10g conditional formatting
ORacle reports 10g
Trying to hide a txt field without losing the line
If I hide the field depending on a condition, all lines below move up - I do not want this to happen
Any suggestions ?
XML is out of the question at this time on this report.If possible, change the vertical elasticity of the item to 'Fixed'. If it is not feasible, then do you have any other items on left or right of the hidden item, which you do not hide? If you enclose all the items (including the item which is in question) within a frame. And change the line color of the frame to transparent. Vertical elasticity as 'Variable'. If that is also not possible, then create a boilerplate text (type . there), next to the item. Change the color of the '.' to white and font size to 2. So it is not visible. When item is hidden, '.' will be there and lines wouldn't move up.
Hope this helps. -
Truncate RTF character in varchar2 field
Hi everyone.
I have a varchar2 field in a table on Oracle 10g. I need to cut all RTF characters from the data that is stored in
this field and only extract the simple text without any format.
Is there any way or a SQL function to eliminate those characters and retrive only the simple text in a Query?
or
Do I need to develop a special procedure in Oracle or in any Language in order to do that proccess ?
Thanks.
Andres.Tables don't have 'fields'.
So what you need to do in your 3GL program I do not know.
People using Oracle, with probably apply regexp_replace on that column.
Sybrand Bakker
Senior Oracle DBA -
Hi
I have a variable vsWhere.
vsWhere := 'WHERE TABLE.COLUNM1 = 1 AND TABLE.COLUMN2 = 3'
I have too the parameter :P_WHERE in the report
I tried to past the variable to parameter in report, but is not ok. The report show just the word "WHERE", why?
ex: vsOther_parameter := 'PARAMFORM=NO BLANKPAGES=NO P_WHERE='vsWhere;
forms and reports 10g
att,
MarcosOk
vsOther_parametro := 'PARAMFORM=NO BLANKPAGES=NO MAXIMIZE=YES'
vsOther_parametro := vsOther_parametro || ' P_WHERE=WHERE VI_MOVIMENTO_ESTOQUE.TIPO = 1 AND VI_MOVIMENTO_ESTOQUE.STATUS = 2';
P_WHERE is parameter of report.
report_id:=FIND_REPORT_OBJECT('AEF2001');
----- call the procedure
RUN_REPORT_OBJECT_PROC(report_id, vsReport_servname, vsReport_desformat,
CACHE
vsReport_filename,
vsReport_desname,
vsOther_parametro, vsReport_servlet);
----- end call the procedure
--- procedure that call report
PROCEDURE RUN_REPORT_OBJECT_PROC(
report_id REPORT_OBJECT,
report_server_name VARCHAR2,
report_format VARCHAR2,
report_destype_name NUMBER,
report_file_name VARCHAR2,
report_desname VARCHAR2,
report_otherparam VARCHAR2,
reports_servlet VARCHAR2) IS
report_message VARCHAR2(100) :='';
rep_status VARCHAR2(100) :='';
vjob_id VARCHAR2(4000) :='';
hidden_action VARCHAR2(2000) :='';
v_report_other VARCHAR2(4000) :='';
i number (5);
c char;
c_old char;
c_new char;
BEGIN
SET_REPORT_OBJECT_PROPERTY(report_id,REPORT_COMM_MODE,SYNCHRONOUS);
SET_REPORT_OBJECT_PROPERTY(report_id,REPORT_EXECUTION_MODE,BATCH);
SET_REPORT_OBJECT_PROPERTY(report_id,REPORT_FILENAME,report_file_name);
SET_REPORT_OBJECT_PROPERTY(report_id,REPORT_SERVER,report_server_name);
SET_REPORT_OBJECT_PROPERTY(report_id,REPORT_DESTYPE,report_destype_name);
SET_REPORT_OBJECT_PROPERTY(report_id,REPORT_DESFORMAT,report_format);
hidden_action := hidden_action ||'&report='||GET_REPORT_OBJECT_PROPERTY(report_id,REPORT_FILENAME);
hidden_action := hidden_action||'&destype='||GET_REPORT_OBJECT_PROPERTY(report_id,REPORT_DESTYPE);
hidden_action := hidden_action||'&desformat='||GET_REPORT_OBJECT_PROPERTY (report_id,REPORT_DESFORMAT);
hidden_action := hidden_action ||'&userid='||get_application_property(username)||'/'||get_application_property(password)||'@'||get_application_property(connect_string);
c_old :='@';
FOR i IN 1..LENGTH(report_otherparam) LOOP
c_new:= substr(report_otherparam,i,1);
IF (c_new =' ') THEN
c:='&';
ELSE
c:= c_new;
END IF;
-- eliminate multiple blanks
IF (c_old =' ' and c_new = ' ') THEN
null;
ELSE
v_report_other := v_report_other||c;
END IF;
c_old := c_new;
END LOOP;
hidden_action := hidden_action ||'&'|| v_report_other;
hidden_action := reports_servlet||'?_hidden_server='||report_server_name || encode(hidden_action);
SET_REPORT_OBJECT_PROPERTY(report_id,REPORT_OTHER,'pfaction='||hidden_action||' '||report_otherparam);
report_message := run_report_object(report_id);
rep_status := report_object_status(report_message);
WHILE rep_status in ('RUNNING','OPENING_REPORT','ENQUEUED')
LOOP
rep_status := report_object_status(report_message);
--rep_status := report_object_status(report_job_id);
END LOOP;
IF rep_status='FINISHED' THEN
vjob_id :=substr(report_message,length(report_server_name)+2,length(report_message));
WEB.SHOW_DOCUMENT(reports_servlet||'/getjobid'||vjob_id||'?server='||report_server_name,' _blank');
ELSE
null;
END IF;
END;
--- end procedure that call report
--- procedure encode
FUNCTION ENCODE(URL_PARAMS_IN Varchar2)
RETURN VARCHAR2 IS
v_url VARCHAR2(2000) := URL_PARAMS_IN; -- Url string
v_url_temp VARCHAR2(4000) :=''; -- Temp URL string
v_a VARCHAR2(10); -- conversion variable
v_b VARCHAR2(10); -- conversion variable
c CHAR;
i NUMBER(10);
BEGIN
FOR i IN 1..LENGTH(v_url) LOOP
c:= substr(v_url,i,1);
IF c in (';', '/','?',':','@','+','$',',',' ') THEN
v_a := ltrim(to_char(trunc(ascii(substr(v_url,i,1))/16)));
IF v_a = '10' THEN
v_a := 'A';
ELSIF v_a = '11' THEN
v_a := 'B';
ELSIF v_a = '12' THEN
v_a := 'C';
ELSIF v_a = '13' THEN
v_a := 'D';
ELSIF v_a = '14' THEN
v_a := 'E';
ELSIF v_a = '15' THEN
v_a := 'F';
END IF;
v_b := ltrim(to_char(mod(ascii(substr(v_url,i,1)),16)));
IF v_b = '10' THEN
v_b := 'A';
ELSIF v_b = '11' THEN
v_b := 'B';
ELSIF v_b = '12' THEN
v_b := 'C';
ELSIF v_b = '13' THEN
v_b := 'D';
ELSIF v_b = '14' THEN
v_b := 'E';
ELSIF v_b = '15' THEN
v_b := 'F';
END IF;
v_url_temp := v_url_temp||'%'||v_a||v_b;
ELSE
v_url_temp :=v_url_temp||c;
END IF;
END LOOP;
return v_url_temp;
END;
--- end procedure encode
att,
Marcos
Maybe you are looking for
-
Something is eating the memory!
I used to have 30g of memory, and today I only have 500mb! I got my first message: 'Your start up disk is almost full' yesterday. Over the past few months something has slowly been eating it. I upgraded to Panther a good 6 months ago and also downloa
-
Combine Two Crystal Report In One Report
Hi I made a two crystal report in that two report i used subreport I want to combine this two report. that is i have to make multilevel crystal report. when i Combine this two report the subreport which is contain in that two report is not import. so
-
Navigational Attributes Not Available in Query Designer
I don't see navigational attributes under Dimensions/DimensionA in Query Designer. Is there a switch to enable/disable nav attr. in BW?
-
How do i break out my Apple ID Passwordhow do i break out my Apple ID Password
how do I break my Apple ID Password in icloud
-
RFC connections in SRM 7.0 = ERP EHP4 system setup
Hello, In SRM 7.0 there is a lot being said about the combination with an ERP EHP4 system. I thought that certain capabilities of SRM <> ERP EHP4 in the area of RFC are not supported anymore. SAP is forcing XI/PI for this. When we migrate our R/3 sys