v5.0 to 20.2 - columns displaying as html source - oracle

I have an APEX application that was exported from v5.0 on-premise instance and imported to v20.2 Cloud/PaaS/ATP instance. Just working on getting the pages to run properly.
One classic report region is showing the column values as html source instead of the values. I vaguely recall this happening in v5.0, which was corrected by selecting Display As: Standard Report Column under column attributes, but I don't see this same option under v20.2. Can anyone help.
SQL Source:
select
apex_item.text(p_idx => 12,
p_value => nvl(c002,'0'),
p_size => 20,
p_maxlength => 2) duplicate_qty,
apex_item.checkbox2(p_idx => 14,
p_value => seq_id,
p_checked_values => CASE c003 WHEN '1' THEN seq_id END) analog_placement_flag,
apex_item.checkbox2(p_idx => 16,
p_value => seq_id,
p_checked_values => CASE c004 WHEN '1' THEN seq_id END) delete_row
from apex_collections
where collection_name = 'TEMPCOL';

Navigate to column's property palette (right-hand side of the screen)
scroll down to "Security" section
switch Escape special characters property OFF
That's all.

Related

oracle apex - multiple default value for APEX_ITEM.Select_list_from_query_xl with attribute multiple="multiple"

I'm using oracle 18.
I create dynamically an apex_item's select list in multiple selection mode.
Using the parameter P_attributes => 'multiple="multiple" '
It's working fine except when I try to feed it multiple default value
If I set the value to a single element, it's working.
But if I set the value with more than one item no element is selected.
I tried to space the items with , ; : and space with no result.
Please tell there's a way cause i realy need it to work. End of projetc is near and I don't have a B plan.
lHtml := APEX_ITEM.Select_list_from_query(P_idx => 20,
P_value => '2:3',
P_query => 'select ''blue'' d,1 r from dual union select ''red'',2 from dual union select ''green'',3 from dual',
P_attributes => 'multiple="multiple"',
P_item_id => 'testMultiple',
P_item_label => 'Test Multiple Default');
HTP.P ( lHtml );

How to SUM a column in an oracle apex collection

So I am trying to output the total of a column from a collection.
This is the first query I tried
select sum(C007),sum(C007) A FROM APEX_COLLECTIONS WHERE COLLECTION_NAME='PURCHASE'
This is the second query I tried
select sum(C005*C007),sum(C005*C007) A FROM APEX_COLLECTIONS WHERE COLLECTION_NAME='PURCHASE'
Both produce the same result which list out all the values in the column insted of suming them
Expected Results:
10
Actual Results:
2
2
2
2
2
Please help
Looks like you did something wrong.
I created sample page; it contains a button (which will just submit the page) and an item which will display total (sum of collection's values). Item gets populated by a process which contains everything (for simplicity):
if not apex_collection.collection_exists('PURCHASE') then
apex_collection.create_collection('PURCHASE');
end if;
apex_collection.add_member(
p_collection_name => 'PURCHASE',
p_c001 => 'Little',
p_c007 => 100); --> 100 ...
apex_collection.add_member(
p_collection_name => 'PURCHASE',
p_c001 => 'Foot',
p_c007 => 200); --> ... + 200 = 300
select sum(c007)
into :P7_TOTAL
from apex_collections
where collection_name = 'PURCHASE';
When ran (and after button was pressed), item's value is - as expected - 300.

Oracle Apex past Value using Dynamic Link Item

So I have a link on my SQL query. It can navigate to the next page. But the thing is, I cannot carry the host_id(PK) to the next page: Anyone suggestion?
Concatenate it.
select
'...:P39_COPY_HOST_ID:' || host_id ||'"...'
from ... -------------
this
Or, even better, use apex_page.get_url function:
select ...
'<a href="' ||
apex_page.get_url(p_page => 39,
p_items => 'P39_COPY_HOST_ID',
p_values => host_id)
|| '"</a>' as link
from ...

report error: ORA-06502: PL/SQL: numeric or value error: character string buffer too small APEX

I got this error report error:
ORA-06502: PL/SQL: numeric or value error: character string buffer too small
on Oracle Apex v 20.2
When trying to parse data from .xlsx file to a report window when I increased the number of columns more than 85 columns , and my excel file got more than 300 columns still !
here is my query:
select line_number, col001, col002, col003, col004, col005,
col006, col007, col008, col009, col010,
col011,col012,col013,col014,col015,col016,col017,col018,col019,col020,col021,col022,col023,col024,col025,col026,col027,col028,col029,
col030,col031,col032,col033,col034,col035,col036,col037,col038,col039,col040,col041,col042,col043,col044,col045,col046,col047,col048,col049,col050,col051
,col052,col053,col054,col055,col056,col057,col058,col059,col060,col061,col062,col063,col064,col065,col066,col067,col068,col069,col070,
col071,col072,col073,col074,col075,col076
,col078,col079,col080,col081,col082,col083,col084
col085,col086,col087,col088,col089,col090
-- more columns (col011 to col300) can be selected here.
from apex_application_temp_files f,
table( apex_data_parser.parse(
p_content => f.blob_content,
p_add_headers_row => 'Y',
--
p_xlsx_sheet_name => :PX_XLSX_WORKSHEET,
--
p_store_profile_to_collection => 'FILE_PARSER_COLLECTION',
p_file_name => f.filename ) ) p
where f.name = :PX_FILE
But If I select only 85 columns or less it works fine.
Any help !
As far as I can tell, you can't do it as you hit the limits.
However, what you might do is one of the following options:
split the file into smaller chunks - 4 files with approx. 80 columns (as you said that 85 columns can be used). Each of them should contain the ID column which uniquely identifies each row, so that you could later "merge" them. That process probably requires 4 different database tables, as well as a little bit of programming efforts afterwards
save the file as a CSV (textual) file. Use SQL Loader to load it into the database. It doesn't have such a restriction and is VERY FAST so - you'd load it all in a single run.
alternatively, you could use that file as a source for the external table. Note that this option requires access to the database server (while SQL Loader works with files on your own PC)

Remove all dots from a String except first, with Oracle REGEXP_REPLACE

I want to use the Oracle REGEXP_REPLACE to remove some dots from a String.
I have to remove from the second dot if exists.
For example:
4 => 4
5 => 5
5.1 => 5.1
5.1.1 => 5.11
5.1.2 => 5.12
5.1.2.1 => 5.121
5.1.2.2 => 5.122
6 => 6
I have this
select REGEXP_REPLACE(num, '(\d+)(\.)(\d+)(\.)(\d+)', '\1.\3\5')
from my_table;
the problem is that my query is made just for two dots. If the string has more than two dots, I have to modify the query to accept more dots and so.
Is there any way to do this automatically?
Thanks
A posible "dirty" solution
select REGEXP_REPLACE(num, '(\d+)(\.)(.*)', '\1\2') ||
REPLACE( REGEXP_REPLACE(num, '(\d+)(.*)', '\2') ,'.','')
from my_table;
and although it's not at all clear, it works.
SELECT SUBSTR(mystr, 1, INSTR(mystr,'.'))
|| REPLACE(SUBSTR(mystr, INSTR(mystr,'.')+1),'.')
FROM my_table;

Resources