Oracle APEX 5 Select List Error ORA-01400 - sql

i have a Problem with Oracle APEX 5.
I have a Popup with Textareas and with a Select List. I can write the Data of the Textareas without Problem into my Database, but i can not write the Data of my Select list into my Database. I alway get the Error ORA-01400 Server Error Insert of NULL imposible.
I also tried to write Hard data in the Table so i Changed the PLSQL to:
begin
INSERT INTO STATUS_TO_CHANGE (CHANGE_ID, CHANGE_STATUS_ID)
VALUES (:P2_CHANGE_ID, '43');
end;
and it worked without Problems :(
Maybe someone can help me :O
I use a own button to save the Textarea and a own button for the select list.
Code of my Dynamic Action:
begin
INSERT INTO STATUS_TO_CHANGE (CHANGE_ID, CHANGE_STATUS_ID)
VALUES (:P2_CHANGE_ID, :P2_STATUS_DESCRIPTION);
end;
Name of the Select List: P2_Status_Description
Select List with save Button .jpg
Error MessageData in the Table Change_Status which is shown in the LOV in the Select list
Thanks to all :)

I can't see images right now.
Anyway: this is, I believe, a "Execute PL/SQL Code" dynamic action, right? You put that BEGIN-END block into the "PL/SQL Code", but - did you put P2_CHANGE_ID and P2_STATUS_DESCRIPTION into Items to Submit? If not, do it and then try again.

Related

"Catching" query from oracle forms

I would like to know if it is possible and how to "catch" query
or WHERE part of SELECT after i enter value and press F8 to excecute query,
is it possible to catch that query and how.
tnx
Use get_block_property built-in. One of its parameters is last_query which
Returns the SQL statement of the last query in the specified block
Also, have a look at default_where and onetime_where parameters.
For more info, see Online Forms Help system (now that you know what to search for).
You can also create a POST-QUERY trigger and in it add code similar to the following:
DECLARE
lastSuccessfulQuery varchar2(4000);
BEGIN
lastSuccessfulQuery := :SYSTEM.LAST_QUERY;
--
-- Do something with the value here
--
END;

trying to use trigger

I'm trying to activate a trigger when a new employee is added. the trigger should store the username of the person that has done the insert and the time it happened. Using Oracle database.
So far my code for the trigger is:
CREATE OR REPLACE TRIGGER insert_2
AFTER INSERT ON employees
for each row
DECLARE
vUser varchar(50);
begin
select user into vUser from dual;
insert into audit_cheker1 (date_create, inserted_by)
values (sysdate(), vUser);
END;
/
The trigger works but after I try to insert a new record it doesn't work and tells me error in the trigger.
The error message is telling you your trigger is invalid, that is it contains syntax errors and cannot be compiled. So you need to fix the compilation errors.
There are several ways to find errors. You can run a query:
select * from user_errors
where type = 'TRIGGER'
and name = 'INSERT_2'
/
You could use the SQL*Plus command show errors after the CREATE TRIGGER statement.
Or, as it seems you're using SQL Developer, you could open the trigger in the Object Navigator. You'll see the tab has several panes, one of which is labelled Errors. Open that pane to see what's wrong.
Here is one for free: although sysdate is technically a function it is a special one. It never takes any parameters and calling it with brackets is wrong. Remove these brackets: sysdate().

Sql server trigger : Invalid 'inserted' object name

I have a table that I want to test on it a trigger I try to SELECTED the line of
the query to see what the table contains but an error appear and In all MY sql project inserted and deleted table doesn't work for me this is what I wrote
the is the error that appear (On the Image)
CREATE TRIGGER TR
on Ligne
for insert
as
begin
select * from inserted
end
please is there any solution for this problem and thanks
I find that when i hover on inserted it show me this
Have you made sure intellisense is enabled in SSMS ?
Go to Tools >> Options >> Text Editor >> Transact-SQL >> IntelliSense
Then - if it is enabled - sometimes it helps to refresh the local cache:
Have you tried placing an i at the back of the keyword, inserted?
CREATE TRIGGER TR
on Ligne
for insert
as
begin
select * from inserted i
end

New to SQL developer - get "invalid SQL statement" whatever I try to do (ORA:00900)

I have a view set up where I'm supposed to be able to access the tables, but any query I try to write throws the same error message. Does anyone know what could be wrong, or can someone suggest some next steps for troubleshooting? Is there something I may need to do prior to querying these tables?
You can't run a MySQL command like SHOW TABLES in Oracle.
SHOW is a SQL*Plus command. It lets you see what your session settings are.
SHOW ALL or SHOW PAGESIZE
You could create a SQL Code Template called SHOW or SHOWTABLE that you can activate to write the SQL for you, e.g.
select table_name from user_tables order by 1;

View code inside procedure in SQL developer

I have a procedure in SQL developer and I want to view what is written inside that procedure..how should I do it?
I am unable to see the code written inside the procedure but I am able to see the procedure structure when I run the query desc schema name.procedure name
Any help is appreciated..
You can use the connections tab which is in the left side of sql developer.
Click the + icon near schema name then + near procedure as shown in the pic.Under that you will have all the existing procedure. You can click any of it to view
SQL Developer
Browse to the connection name in the connections tab, expand the required object and just click, it will open the code in new tab.
ALL|USER|DBA_SOURCE view
Alternatively, you could query the DBA_SOURCE view:
SELECT text
FROM user_source
WHERE owner='<owner_name>'
AND name ='<procedure_name>'
AND type ='PROCEDURE';
make sure you put the owner_name and procedure_name in UPPER case, or in the exact case if you created using double-quotation marks.