Sure it's in the documentation, but not listed under new features.
Where to find declarative favicon setting in APEX 5.1 |
Amanda for APEX 4.2;
Christian if you're still using APEX Listener;
Now we have an dedicated attribute. Neat.
Where to find declarative favicon setting in APEX 5.1 |
— Simon Greenwood (@APEXORADEV) December 7, 2016
IMSS Demonstration |
with years as ( select to_char(trunc(sysdate,'yy')+rownum-1,'dy') dy from dual connect by level <= 365 ) select count(*) ,sum(case when dy in ('sat','sun') then 1 end) weekends from yearsYou can see this demonstrated at livesql.oracle.com
not a good wrap |
,to_char(created_date,'DD-MON-YYYY"<br>"HH24:MI:SS') created_date
white-space:nowrap
If column is varchar, won't order nice |
Declarative column attributes, using DD-MON-YYYY "<br>"HH24:MI:SS |
.date_fmt {white-space:nowrap;}
This is not me. I'd never play for Melbourne... |
APEX 5.1 Column Mapping |
OracleJET Custom JavaScript |
sys_context('userenv','db_name') = 'dev'
This isn't bad, I have a common function I call for this sort of thing. But it's quite granular.APEX 5.1 Column Attributes |
Pre 5.1 Build Option on Column |
select null from apex_application_build_options where build_option_name like 'My build option' and build_option_status = 'Include' and application_id = :APP_IDAgain, you could put this in a re-usable function/view, not that you would need it often.
One of my favourite features |
alter table my_table modify (id generated as identity START WITH LIMIT VALUE);
I love these diagrams |
select table_name, column_name, generation_type, sequence_name from all_tab_identity_cols where table_name = 'MY_TABLE' TABLE_NAME COLUMN_NAME GENERATION_TYPE SEQUENCE_NAME ------------- ----------- --------------- ------------- MY_TABLE ID BY DEFAULT ISEQ$$_430382
SQL Developer Table properties |
alter sequence
to those generated by the system from the table DDL, you get the following error.ORA-32793: cannot alter a system-generated sequence
declare l_val pls_integer; begin for i in 1..240 -- use the difference between .nextval and max(id) loop l_val := ISEQ$$_430382.nextval; -- change to sequence returned from all_tab_identity_cols end loop; end; /This might be considered un-elegant, a dirty way to fix the problem. We're on 12c, surely there's a better way.
Now illustrate this in action.START
WITH
LIMIT VALUE
, which is specific toidentity_options
, can only be used withALTER
TABLE
MODIFY
. If you specifySTART
WITH
LIMIT VALUE
, then Oracle Database locks the table and finds the maximum identity column value in the table (for increasing sequences) or the minimum identity column value (for decreasing sequences) and assigns the value as the sequence generator's high water mark. The next value returned by the sequence generator will be the high water mark +INCREMENT
BY
integer
for increasing sequences, or the high water mark -INCREMENT
BY
integer
for decreasing sequences.
drop table seq_reset_test; create table seq_reset_test -- basic table with my suggested identity column options (id number generated by default on null as identity ,CONSTRAINT seq_reset_test_pk PRIMARY KEY (id) ,label varchar2(20) ); Table SEQ_RESET_TEST created. -- Will be given first ID of 1 insert into seq_reset_test (label) values ('Initial'); 1 row inserted. -- Simulate update of db without synchronising sequence update seq_reset_test set id = 1000 where id = 1; 1 row updated. -- ID too high for sequence select * from seq_reset_test; ID LABEL ---------- -------------------- 1000 Initial -- Find sequence name from all_tab_identity_cols select ISEQ$$_404558.currval from dual; CURRVAL ---------- 1 -- This will use ID 2, risking PK violation insert into seq_reset_test (label) values ('Second'); 1 row inserted. -- Magic alter statement alter table seq_reset_test modify (id generated by default on null as identity start with limit value); Table SEQ_RESET_TEST altered. -- This will use the updated sequence, avoiding max(id) value insert into seq_reset_test (label) values ('Third'); 1 row inserted. -- Proof select * from seq_reset_test; ID LABEL ---------- -------------------- 1000 Initial 2 Second 1001 Third select ISEQ$$_404558.currval from dual; CURRVAL ---------- 1001
drop table orbiters; drop sequence orbiter_seq; create sequence orbiter_seq; create table orbiters (id number not null ,CONSTRAINT orbiter_pk PRIMARY KEY (id) ,position number not null ,planet varchar2(15) not null ,name varchar2(30) not null ,distance number not null ,created_date date not null ,created_by varchar2(50) not null ); create or replace TRIGGER orbiters_biur BEFORE INSERT OR UPDATE ON orbiters FOR EACH ROW DECLARE BEGIN IF INSERTING THEN :NEW.id := COALESCE(:NEW.id , orbiter_seq.NEXTVAL); :NEW.created_date := COALESCE(:NEW.created_date , SYSDATE); :NEW.created_by := COALESCE(:NEW.created_by , apex_application.g_user, USER); END IF; END; / insert into orbiters (position,planet,name,distance) values (3,'Earth', 'Luna', 384) ; insert into orbiters (position,planet,name,distance) values (3,'Earth', 'SpaceX', 400/1000); insert into orbiters (position,planet,name,distance) values (3,'Earth', 'ISS', 400/1000); select id, name from orbiters; ID NAME 1 Luna 2 SpaceX 3 ISSIt's not rocket surgery...
alter table orbiters modify created_by default coalesce( sys_context('APEX$SESSION','app_user') ,regexp_substr(sys_context('userenv','client_identifier'),'^[^:]*') ,sys_context('userenv','session_user') );Sven's coalesce to resolve the username when the environment may or may not be APEX is neat.
alter table orbiters modify id default orbiter_seq.NEXTVAL; drop trigger orbiters_biur;If you get ORA-02262, check your sequence exists and you've typed it properly.
alter table orbiters modify id GENERATED BY DEFAULT ON NULL AS IDENTITY start with 10;
ORA-30673: column to be modified is not an identity column
drop trigger orbiters_biur;
alter table orbiters modify id default orbiter_seq.NEXTVAL; alter table orbiters modify created_date default sysdate; alter table orbiters modify created_by defaultsys_context(
'APEX$SESSION'
,
'app_user'
)
; drop trigger orbiters_biur;
<span title="#RECENT_NOTE#" data-key="#ROW_KEY#">#MY_COLUMN#</span>
Set Value action example |
this.triggeringElement
, which identifies the element being clicked. In this case it's the table cell, so .children()
identifies the span from the HTML expression; .data()
grabs the extra attribute; and .attr()
grabs the title tooltip.$(this.triggeringElement).children('span').data('key') + ': ' + $(this.triggeringElement).attr('title')
#P50_LAST_NOTE#
&P50_LAST_NOTE.
<span title="#RECENT_NOTE#">#MY_COLUMN#</span>
$('td[headers=my_column] span').each( // for every data cell in the column function() { // copy the title attribute to the parent cell
$(this).parent().attr('title', $(this).attr('title')); });This JavaScript copies the title attribute from the inner span to the surrounding td tag, so you will see the tooltip when the cursor is anywhere within the cell. I find this relevant when there is a bit of spacing/padding in the report.
sys_context('userenv', 'server_host')
procedure xyz(p_in number) is begin debug('start xyz'); debug('p_in:'||p_in); -- do stuff debug('end xyz'); end;I think you're essentially coding blindfolded without it. You could only infer this procedure was executed because of whatever it does, and if something goes wrong how do you know what was passed in? Where did it get up to? Did it execute at all?
developer toolbar |
Click/tap to embiggen |
Isn't it so great we can manipulate 8 columns at once like this? |
select EMPNO, ENAME, JOB, MGR, HIREDATE, SAL, COMM, DEPTNO from EMP ) r where ((instr(upper("ENAME"),upper(:APXWS_SEARCH_STRING_1)) > 0 or instr(upper("SAL"),upper(:APXWS_SEARCH_STRING_1)) > 0 )) ) r where rownum <= to_number(:APXWS_MAX_ROW_CNT)
Preference for application item prefix in #orclapex ?— Scott (@swesley_perth) July 21, 2016
F_ | 15 | Inspired by APEX team, no doubt. +1 for me | |
APP_ | 10 | Fair call, but could match built-in | |
G_ | 6 | Global, clever. One person combines this with A_ for application scope. | |
{project} | 5 | To match the prefix on your tables, right? | |
AI_ | 3 | Can't deny the provenance | |
{none} | 3 | This is dangerous, potential clash with built-ins | |
A_ | 1 | Based on item scope. |
— Chris Saxon (@chrisrsaxon) July 5, 2016