"PLS-00103: Encountered the symbol "end-of-file" when expecting one of the following: ;" Can anyone spot the error in my code? - pls-00103

I'm following an Oracle guide call 'Adventure Travel' and in the guide it says to create this procedure:
CREATE OR REPLACE PROCEDURE
add_country_for_activity(p_activity_num AT_COUNTRY_ACTIVITIES.activity_num%TYPE,p_country_id AT_COUNTRY_ACTIVITIES.country_id%TYPE)
IS
BEGIN
INSERT INTO AT_COUNTRY_ACTIVITIES (country_id,activity_num) VALUES (p_country_id,p_activity_num);
END;
but when I view this procedure in the Apex object browser, it says it has the "expecting ;..." error. Can anyone see where the error is in this code? Thanks in advance.

Related

error when creating a new pre-rendering process (automaic row fetch)

so i had a problem with my page and i after i compared it with other similar pages i noticed it's missing a pre-rendering -> after header -> process which basically reloads data automatically with the item value that i sent from the previous page. the process is called automatic row fetch [lefacy].
i tried to create it for that page but it always show an error when i try to load it.
any tips what i might be missing
and i get this error message
ORA-06550: line 1, column 22: PL/SQL: ORA-00936: missing expression
Contact your application administrator. Details about this incident are available via debug id "353666".
Technical Info (only visible for developers)
error_statement:
begin begin select into from "CONTRAT" where "ID_CONTRAT" = :p_rowid; end;
end;
Your select clause is incomplete. You should inform something on select and into.
example:
declare
v_name varchar2(50);
begin
select NAME
into v_name
from EMPLOYEE;
end;

SQL Insert Statement causing error in Oracle

I'm trying to do this
INSERT INTO INSPECTIONOFFICE (INSPOFFICE_ID, INSPOFFICE_NAME, INSPOFFICE_STREET, INSPOFFICE_CITY, INSPOFFICE_STATE, INSPOFFICE_ZIPCODE, INSPOFFICE_CONTPERSONFNAME, INSPOFFICE_CONTPERSONLNAME, INSPOFFICE_CONTPERSONPHONE, INSPOFFICE_CONTPERSONEMAIL)
VALUES (12, 'InspectionOffice1', '121 Ames st', 'Omaha', 'NE', 68128, 'Brad', 'Foley', '4022853487', 'BradFoley#gmail.com');
but I get an error
Error starting at line : 22 in command -
INSERT INTO INSPECTIONOFFICE (INSPOFFICE_ID, INSPOFFICE_NAME, INSPOFFICE_STREET, INSPOFFICE_CITY, INSPOFFICE_STATE, INSPOFFICE_ZIPCODE, INSPOFFICE_CONTPERSONFNAME, INSPOFFICE_CONTPERSONLNAME, INSPOFFICE_CONTPERSONPHONE, INSPOFFICE_CONTPERSONEMAIL)
VALUES (12, 'InspectionOffice1', '121 Ames st', 'Omaha', 'NE', 68128, 'Brad', 'Foley', '4022853487', 'BradFoley#gmail.com')
Error at Command Line : 22 Column : 13
Error report -
SQL Error: ORA-04098: trigger 'JMEEK.INSPECTIONOFFICE_INSPECTIONOFF' is invalid and failed re-validation
04098. 00000 - "trigger '%s.%s' is invalid and failed re-validation"
*Cause: A trigger was attempted to be retrieved for execution and was found to be invalid. This also means that compilation/authorization failed for the trigger.
*Action: Options are to resolve the compilation/authorization errors, disable the trigger, or drop the trigger.
Any idea how to fix this?
seems you do not have permission access to the trigger JMEEK.INSPECTIONOFFICE_INSPECTIONOFF
or have some compilation problem with it...
you should take a look in the trigger.
or if you don't know what a trigger is, call a experienced job's teammate. :)
btw, if you are alone, and it don't matter too much.. you can disable / drop the trigger..
this command disable, you can enable later
ALTER TRIGGER JMEEK.INSPECTIONOFFICE_INSPECTIONOFF DISABLE;
this command drop the trigger, you will lose it forever (if you don't have a backup)
drop trigger JMEEK.INSPECTIONOFFICE_INSPECTIONOFF;
The trigger JMEEK.INSPECTIONOFFICE_INSPECTIONOFF, which I am guessing you wrote because it's in the JMEEK schema, which (again I'm guessing) seems to be yours, is invalid, meaning it has compilation errors. To find out what those errors are you should execute the query
SELECT *
FROM ALL_ERRORS
WHERE OWNER = 'JMEEK' AND
NAME = 'INSPECTIONOFFICE_INSPECTIONOFF'
ORDER BY SEQUENCE
None of us can do much else for you because we don't know what this trigger looks like. If you need to see the source code you can execute the following query:
SELECT LINE, TEXT
FROM ALL_SOURCE
WHERE OWNER = 'JMEEK' AND
NAME = 'INSPECTIONOFFICE_INSPECTIONOFF'
ORDER BY LINE
Or you can use an IDE such as Oracle's free SQL Developer product which will make all this a lot easier for you.

ORA-04088: error during execution of trigger - additional errors

I have a blank table for which I've set up a trigger:
CREATE OR REPLACE TRIGGER authors_bir
BEFORE INSERT ON authors
FOR EACH ROW
begin
if upper(:new.name) = 'TEST' then
raise_application_error(-20001, 'Sorry, that value is not allowed.');
end if;
end;
After executing:
insert into AUTHORS
VALUES (1, 'test', '1-Jan-1989', 'M');
Why am I getting ORA-06512 and ORA-04088 error messages in addition to the expected ORA-20001 error prompt?
ErrorMessage
Error starting at line : 5 in command -
insert into AUTHORS
VALUES (1, 'test', '1-Jan-1989', 'M')
Error report -
ORA-20001: Sorry, that value is not allowed.
ORA-06512: at "RPS.AUTHORS_BIR", line 3
ORA-04088: error during execution of trigger 'RPS.AUTHORS_BIR'
Your trigger works perfectly and ORA-06512 is part of debugging mode and tells you what line of code raised that ORA-20001 that you coded. While ORA-04088 is saying that an error has occurred in the trigger. Both error codes are GENERIC part of oracle troubleshooting report.
According to documentation:
ORA-06512: at stringline string
Cause: Backtrace message as the stack is unwound by unhandled exceptions.
Basically, this error is part of the error stack telling at which line the actual error occurred.
And documentation:
ORA-04088: error during execution of trigger 'string.string'
Cause: A runtime error occurred during execution of a trigger.
And this error is a part of the error stack telling you that error actually occurred in a trigger.
When an unhandled error occurs, error stack is always displayed. If you want to display just the error message, you could use an exception handling part so body of the trigger would look something like this:
begin
if upper(:new.name) = 'TEST' then
raise_application_error(-20001, 'Sorry, that value is not allowed.');
end if;
exception
when others then
dbms_output.put_line(sqlcode|' '|sqlerrm);
end;

Difference between oracle call and execute in context of error throwing

I have some procedure written in Oracle. Unfortunately I can't show its code. Somewhere inside it is select where execution crashed because of absence of required data. It looks like this
select value into l_value
from config
where code = upper(p_code);
So when I call this procedure like this (in SqlDeveloper)
execute some_package.some_procedure('CODE');
it throws
Error report -
ORA-01403: no data found
ORA-06512: at "XXXXXXXXXXXXXXXXXXX", line 111
ORA-06512: at "XXXXXXXXXXXXXXXXXXX", line 111
ORA-06512: at line 1
01403. 00000 - "no data found"
*Cause: No data was found from the objects.
*Action: There was no data from the objects which may be due to end of fetch.
But when I call it like this
call some_package.some_procedure('CODE');
it crashes at the same place (as I can suggest from the result, stored in DB), but it does no throw an exception.
some_package.some_procedure('CODE') succeeded.
What happens? And why there is such difference?
NO_DATA_FOUND exception behavior is special. It is handled by default in SQL context but not in PL/SQL. In SQL no data found is not considered as an error, it happens all the time that there is no data that meets certain condition.
CALL is SQL command whereas EXEC is a shortcut for BEGIN <code> END; which is PL/SQL.

How to fix Unresolved Reference Error

I have an error message that states: "Procedure [schemaName].[my_proc] has an unresolved reference to object [dbo].[callingProc]. I searched the web, but there doesn't appear to be many solutions. Do you have any suggestions? My Code looks something like the following:
create procedure schemaName.[my_proc]
as
begin
declare #variable int 0;
exec dbo.callingProc
#variable;
end;
What message is trying to tell you is that there is no [dbo].[callingProc] procedure in your database.
Reason for this might be as simple as typo, or callingProc might be under different schema than dbo.
I did a little more research and found the solution!
The dbo.callingProc and schemaName.[my_proc] were under different schema names. I went into the Database and changed the dbo.callingProc "Build Action" to "Build." The dbo.callingProc was not getting compiled, so it produced the reference error because the procedure could not be found.