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 );
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.
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 ...
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)
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;