Discussions
Categories
- 197K All Categories
- 2.5K Data
- 546 Big Data Appliance
- 1.9K Data Science
- 450.8K Databases
- 221.9K General Database Discussions
- 3.8K Java and JavaScript in the Database
- 31 Multilingual Engine
- 552 MySQL Community Space
- 479 NoSQL Database
- 7.9K Oracle Database Express Edition (XE)
- 3.1K ORDS, SODA & JSON in the Database
- 555 SQLcl
- 4K SQL Developer Data Modeler
- 187.2K SQL & PL/SQL
- 21.4K SQL Developer
- 296.3K Development
- 17 Developer Projects
- 139 Programming Languages
- 293K Development Tools
- 110 DevOps
- 3.1K QA/Testing
- 646.1K Java
- 28 Java Learning Subscription
- 37K Database Connectivity
- 158 Java Community Process
- 105 Java 25
- 22.1K Java APIs
- 138.2K Java Development Tools
- 165.3K Java EE (Java Enterprise Edition)
- 19 Java Essentials
- 162 Java 8 Questions
- 86K Java Programming
- 81 Java Puzzle Ball
- 65.1K New To Java
- 1.7K Training / Learning / Certification
- 13.8K Java HotSpot Virtual Machine
- 94.3K Java SE
- 13.8K Java Security
- 205 Java User Groups
- 24 JavaScript - Nashorn
- Programs
- 468 LiveLabs
- 39 Workshops
- 10.2K Software
- 6.7K Berkeley DB Family
- 3.5K JHeadstart
- 5.7K Other Languages
- 2.3K Chinese
- 175 Deutsche Oracle Community
- 1.1K Español
- 1.9K Japanese
- 233 Portuguese
can some one explain me this

Answers
-
In the context of a trigger, set the new value of the created_by column to whatever the function returns. If the function returns null then take the current user.
-
Hi,
do you have a little bit more of your coding ?
I expect it is from a trigger and it will assign a value to the created_by for new or updated rows in your table.
v('xxx') may be a function to get a name of the user. If this function doesn't return a value different from NULL then the name of connected db-user is inserted.
regards
Kay -
CREATE TABLE "ROLES"
( "ID" NUMBER(8,0) NOT NULL ENABLE,
"ROLE_NAME" VARCHAR2(255) NOT NULL ENABLE,
"CREATED_BY" VARCHAR2(255),
"CREATED_ON" DATE,
"UPDATED_BY" VARCHAR2(255) NOT NULL ENABLE,
"UPDATED_ON" DATE NOT NULL ENABLE,
CONSTRAINT "ROLES_PK" PRIMARY KEY ("ID")
USING INDEX ENABLE
)
/
CREATE OR REPLACE TRIGGER "BI_ROLES"
before insert on "ROLES"
for each row
begin
if :NEW."ID" is null then
select "ROLES_SEQ".nextval into :NEW."ID" from sys.dual;
end if;
if inserting then
:new.created_on := sysdate;
:new.created_by := nvl(v('APP_USER'),user);
:new.updated_on := sysdate;
:new.updated_by := nvl(v('APP_USER'),user);
elsif updating then
:new.updated_on := sysdate;
:new.updated_by := nvl(v('APP_USER'),user);
end if;
end;
-
:new.created_by := nvl(v('APP_USER'),user);
for what is the function of "v " in that line
-
is there any stored function called v?
-
V is a function that someone has created.
select text from all_source where name ='V' order by type, line;
-
It is a userd defined function.
Do a "desc v" to see the input / output parameters
Investigate the views dba_source / user_source to see the coding.
-
V() is the APEX function to get an application variable. In this case, it's getting the currently logged-on APEX user.
-
thanks for your answer i understand it ow very vell
-
will this APEX function work on a pure database trigger and will it be accessible ?
I'm coming from Forms 4.5 (20 years ago) and have only a little knowledge of APEX.