How to Call package successfully - sql

got error when calling package
error is
Error starting at line : 1 in command -
PKG_Generate_GRNo.GenerateGR(TO_NUMBER(:P164_APP_ID,
'9999999'),:APP_USER,:P164_FIRST_NAME,:P164_LAST_NAME,:P164_EMAIL,:P164_SKYPE_ID,:P164_COUNTRY,:P164_DATE_OF_BIRTH)
Error report - Unknown Command
PKG_Generate_GRNo.GenerateGR(TO_NUMBER(:P164_APP_ID,
'9999999'),:APP_USER,:P164_FIRST_NAME,:P164_LAST_NAME,:P164_EMAIL,
:P164_SKYPE_ID,:P164_COUNTRY,:P164_DATE_OF_BIRTH);

Session state protection violation is definitely an Apex error, relating to your page settings. It seems your package is trying to change the state of a read-only page. See this other question.
The item identifier in the error message P164_COURSECOUNT has the same prefix as the parameters you pass to the package (:P164_APP_ID) so presumably they relate to the same page. We know nothing about your application or its architecture, so it's hard to offer concrete advice. Maybe you need to change the page or item settings, maybe you need to change what the package does. Only you can tell the right course of action.

As you didn't post the whole command, a note: you have to enclose it into begin-end block, e.g.
BEGIN
PKG_Generate_GRNo.GenerateGR (TO_NUMBER ( :P164_APP_ID, '9999999'),
:APP_USER,
:P164_FIRST_NAME,
:P164_LAST_NAME,
:P164_EMAIL,
:P164_SKYPE_ID,
:P164_COUNTRY,
:P164_DATE_OF_BIRTH);
END;
/

Related

plsql : New function inside an existing package compilation and syntax check

How do I compile a new function created inside a package in plsql, to see syntactical error and so on
You can't compile a single function - compile the whole package.
If your concern is about invalidating the whole package in case that function has errors, then
create a standalone function (i.e. outside of the package)
debug it
once it is OK (doesn't have syntax errors, returns result as expected), include it into the package
In addition to #Littefoot's advise I'd say: use a proper GUI. Oracle has a free tool called sql developer. It has a great interface for editing database objects (packages/functions/procedures/triggers). It highlights errors and is very well documented (https://www.thatjeffsmith.com/sql-developer/). Note that is does not point out syntax errors - but once you're a bit used to working with pl/sql they become obvious very quickly.
In Oracle, after compiling a procedure/function/package. If there is an error then the command will return with the message:
ORA-24344: success with compilation error
You can then use:
SHOW ERRORS
or
SELECT * FROM USER_ERRORS;
or, for example, for errors with packages in a specific schema:
SELECT *
FROM ALL_ERRORS
WHERE owner = 'SCHEMA_NAME'
AND type IN ( 'PACKAGE', 'PACKAGE BODY');
Which will list the errors (complete with line numbers and error messages) and you can then debug the procedure/function/package and recompile it.
fiddle

SAP HANA - Model inconsistency - during activation

In SAP HANA I get the following Error during Activation:
Repository: Encountered an error in repository runtime extension;Model inconsistency. Create Scenario failed: The following errors occurred: Index does not exist;Failed to get CalcIndex '_SYS_BIC:asdf/CA_asdf_BASE (t -1)' (2007)
What could be the reasons?
Unfortunately the error message does not indicate what the problem is :/
One possible reason is that the underlying view(s) are not activated.
As a result you can not activate the view on top.
In this case the error message indicates that the underlying view (CA_asdf_BASE) is not activated.
So ensure that all underlying views are activated.
If this does not help then try:
Revert to last active version
Repeat the last steps.
Also, try to draw down your data model and check if there is a recursion. Somehow that was the case in my example. I was trying to add a view A into view B, but as a matter of fact, view B had already used view A a few levels below. Logic/brain error :)

Invalid Objects and What issue they can cause in application?

I just wanted to know about some invalid objects which are from Oracle ebs 12.1.3. The list is
CST_LAYER_ACTUAL_COST_DTLS_V
IGW_BUDGET_CATEGORY_V
IGW_REPORT_PROCESSING
FV_FACTS_TBAL_TRX
FV_FACTS_TRX_REGISTER
FV_SF133_ONEYEAR
FV_SF133_NOYEAR
FV_FACTS_TRANSACTIONS
FV_FACTS_TBAL_TRANSACTIONS
ENI_DBI_CO_OBJIDS_MV
PJI_TIME_PA_RPT_STR_MV
POA_MID_BS_J_MV
POA_IDL_BS_J_MV
POA_ITEMS_MV
GL_ACCESS_SET_LEDGERS
LNS_LOAN_DTLS_ALL_MV
OZF_CUST_FUND_SUMMARY_MV
FV_SLA_FV_PROCESSING_PKG
OE_ITEMS_MV
PA_DEDUCTIONS_W
PA_DEDUCTIONS_PUB
PA_DEDUCTIONS_PUB
PA_DEDUCTIONS_W
PA_DCTN_APRV_NOTIFICATION
--object types--
CST_LAYER_ACTUAL_COST_DTLS_V VIEW
IGW_BUDGET_CATEGORY_V VIEW
IGW_REPORT_PROCESSING
PACKAGE BODY FV_FACTS_TBAL_TRX PACKAGE BODY
FV_FACTS_TRX_REGISTER PACKAGE BODY
FV_SF133_ONEYEAR PACKAGE BODY
FV_SF133_NOYEAR PACKAGE BODY
FV_FACTS_TRANSACTIONS
PACKAGE BODY FV_FACTS_TBAL_TRANSACTIONS PACKAGE BODY
ENI_DBI_CO_OBJIDS_MV MATERIALIZED VIEW
PJI_TIME_PA_RPT_STR_MV MATERIALIZED VIEW
POA_MID_BS_J_MV MATERIALIZED VIEW
POA_IDL_BS_J_MV MATERIALIZED VIEW
POA_ITEMS_MV MATERIALIZED VIEW
GL_ACCESS_SET_LEDGERS MATERIALIZED VIEW
LNS_LOAN_DTLS_ALL_MV MATERIALIZED VIEW
OZF_CUST_FUND_SUMMARY_MV MATERIALIZED VIEW
FV_SLA_FV_PROCESSING_PKG PACKAGE BODY
NIB_MV_TB MATERIALIZED VIEW
OE_ITEMS_MV MATERIALIZED VIEW
PA_DEDUCTIONS_W PACKAGE
PA_DEDUCTIONS_PUB PACKAGE
PA_DEDUCTIONS_PUB PACKAGE BODY
PA_DEDUCTIONS_W PACKAGE BODY
PA_DCTN_APRV_NOTIFICATION PACKAGE BODY
So I wanted to know that If I keep them invalid what problem they can cause?
Steps I took to know myself:-
I have searched over Oracle support and google by object name but the only thing i get there is patch no to resolve the issue or in some case that ignore these objects they will do nothing.
If anyone have information about these object and what problem they can cause in application. Please do share.
Thanks in Advance!!!
Tom Kyte, a noted Oracle expert, says
They will fix themselves as they are executed or accessed. I never
worry about some invalid objects -- you'll almost always have some
somewhere.
This is usually true as long as:
the database was installed correctly
patches and upgrades have been installed correctly
you have not changed oracle front end code or oracle database code
data that is being entered remains within expected ranges
Invalid materialized views are not usually significant. In 9, 10 and 11 they appear to become invalid as soon as new data is added to the underlying tables. They can still be used even if they are invalid.
Invalid views are compiled on access and if there are no errors become usable.
The same is true of packages and package bodies: if there are no errors they are compiled on access. How your front end handles the error message before the compilation is not the same for all applications. If you try and access a package that cannot compile due to a code error then you will not get any results and a PL/SQL error is returned.
To see what the cause of your problem is:
compile all invalid objects manually or use dbms_utility.compile_schema( 'YourSchema' );
for anything that will not compile you can find out more with the query
select * from all_errors:
If you find errors in Oracle supplied objects you then have to determine the source:
incorrect install or patching
known Oracle bug that should be patched
known Oracle bug that can be ignored
other cause which is beyond the scope of the question

Why is my Deployment script causing me errors?

I am working on a project in visual studio 2012. Recently, I added a database project to the solution. The database already existed before I added it to the solution and everything worked fine.
Now, however, when I try to run the application I get errors. The errors are being caused by a computer-generated file called [database name].sql. At the top of the tile, it reads:
/*
Deployment script for [the database name here]
This code was generated by a tool.
Changes to this file may cause incorrect behavior and will be lost if
the code is regenerated.
*/
This file gets re-created every time the application runs. The errors that occur appear to be syntax errors. I cannot fix them because any changes I make to the file are irrelevant because a new file gets generated with each run and the errors re-appear.
I tried looking into this more online but had trouble. This is all rather new to me.
Here are some of the errors being created:
GO
:setvar DatabaseName "(the database name is here)"
which gives me three errors that read:
Error 88 SQL80001: Incorrect syntax near ':'.
Error 89 SQL80001: 'DatabaseName' is not a recognized option.
Error 90 SQL80001: Incorrect syntax near '"(the database name is here in the code)"'.
Also, there is a line of code that reads:
CREATE USER [(the domain)\(the username)] FOR LOGIN [(the domain)\(the username)];
GO
which gives the following error:
Error 119 SQL72014: .Net SqlClient Data Provider: Msg 15401, Level 16, State 1, Line 1 Windows NT user or group '(the domain)\(the username)' not found. Check the name again.
From the errors you have posted it looks like there are two issues:
Windows NT user or group '(the domain)\(the username)' not found. - The user being used to access the database doesn't exist. As it's a Windows user I'm guessing that it uses the current user's credentials.
Make sure that your instance of SQL can accept Windows logins and that you (and anyone else building the software) has the necessary access rights.
'DatabaseName' is not a recognized option. - This is more than likely also caused by the first issue, but double check that the database exists.
The error message caught me out recently as it did not relate to the cause of my problem at all. It turns out my SQL script was incorrectly written (for my case - I forgot to add IDENTITY (1,1) to my PK column) to begin with.
Moral of the story for me was to test out the SQL data file in SSMS first.

DB2 error code -991

I'm getting a return code of -991 upon running a db2 batch cobol program.
The program is attempting to fetch 65 rows within a cursor structure.
I cannot find anything on this particular error, does anyone know what it means ?
You probably want to look at the db2 documentation.
Error code -991 is here.
It says:
-991
CALL ATTACH WAS UNABLE TO ESTABLISH AN IMPLICIT CONNECT OR OPEN TO DB2. RC1= rc1 RC2= rc2
Explanation
Call attach attempted to perform an implicit connect and open as the result of an SQL statement. The connect or open failed with the returned values.
rc1
The value returned in FRBRC1 for the failed CONNECT or OPEN request.
rc2
The value returned in FRBRC2 for the failed CONNECT or OPEN request.
System action
The statement cannot be processed.
Programmer response
Verify that the application intended to use the call attachment facility (CAF) as the mechanism to connect to DB2®. For functions or stored procedures running in the WLM-established stored procedure address space the application must be link-edited with or dynamically allocate the RRS attachment language interface module (DSNRLI), not CAF.
SQLSTATE
57015
Hopefully that means something to you :)
In case you're still stuck, my google-fu is strong.
SQLCODE -991, Error: CALL ATTACH WAS UNABLE TO ESTABLISH AN IMPLICIT CONNECT OR OPEN TO DB2. RC1= RC2=
From http://theamericanprogrammer.com/programming/sqlcodes.shtml