Package forward declaration
Can anyone kindly explain me in detail about Package forward declaration and where this is used and what's the purpose of using it.A example would be good
Thanks in advance
A subprogram declaration called a
forward declaration. It consists of the subprogram
specification in the package body .
CREATE OR REPLACE PACKAGE BODY declare_forward
IS
PROCEDURE pro(. . .); -- forward declaration
PROCEDURE pro2(. . .)
IS -- subprograms defined
BEGIN -- in alphabetical order
pro(. . .);
END;
END declare_forward;
Similar Messages
-
hi,
i have a package
CREATE OR REPLACE PACKAGE BODY pkgemp AS
FUNCTION fNeedsCpeReview(
p_order_id IN VARCHAR2 DEFAULT NULL)
RETURN product_info_tbl
is
CURSOR csr_ord_control IS
SELECT action_cd
FROM ord_control
WHERE order_id = l_order_id;
begin
select * from abc where enum=1234;
execute immediate create table abc(
enum number);
END pkgemp;
-- please forget abt the function and cursor.
-- the table 'abc' is not present in the DB
-- so we cannot execute select statement and compilation error even though we are creatign that table after 'select' statement
-- we need to do forward declarartion.
my question is how do we do a forward declaration for creating a table ?Hi,
Creating tables in procedures is rarely necessary in Oracle.
Describe what you're trying to do, and someone will suggest a good way to do it. Many people have used global temporary tables where they thought creating a table on the fly was necessary.
If you really do have to use table (abc) that may not exist at compile time, or if abc may be dropped and recreated after the procedure is compiled, then do everything that involves abc using dynamic SQL.
Remember that EXECUTE IMMEDIATE works on strings, so
execute immediate create table abc(
enum number);is incorrect, but
execute immediate 'create table abc(
enum number)';will work. -
Forward Declaration in Class Builder
Hi All,
In the Class Builder (SE24)when i create a new Class, There is an option of Forward declaration in the Property Tab. In this, we can add Type Group Interface and Class. What is the Purpose of this forward declaration?
The F1 help does not provide any help.
Regards,
Kapil.in addition to above replies, it can be used for classes and interfaces in that case Forward declaration is equivalent to
CLASS <class_name> DEFINITION LOAD.
interface <interface_name> load
statements which are normally used in Program ( case for local classes )
use of Load from SAP docu
... LOAD
Effect
The variant with the LOAD addition loads a global class class from the Class Library. This statement was needed before Release 6.20 if you wanted to access one of the static components of class from within a program, or to declare an event handler for class before class had been loaded automatically. From Release 6.20 onwards, the LOAD addition is only needed if the compilation of an ABAP program fails because it includes recursive accesses of a globa l class. In such cases, you may be able to make the program compilable by explicitly loading the class before recursion.
Thanks,
kranthi. -
Forward Declaration and "this" keyword
Consider this code:
class A {
private int i = 2 * this.j; // This will be calculated as 2 * 0 = 0
// private int i = 2 * j; //This code will not compile
private int j = 20;
}Why the "this" keyword is required for the j to be accessible? Though it is a forward declaration, what is the significance of "this" which gives visibility to the variable j. Please give some light to this.Though it is a forward declaration, what is the significance of "this" which gives
visibility to the variable jI don't think "this" alters the visibility of j: that is the instance variable j is in scope. However "Use of instance variables whose declarations appear textually after the use is sometimes restricted, even though these instance variables are in scope."
See "8.3.2.3 Restrictions on the use of Fields during Initialization" http://java.sun.com/docs/books/jls/third_edition/html/classes.html#287410
Using "this" you have a reference to the object being constructed with the j instance variable sill having its default value of zero.
Such instance initialisers would appear to be inherently less intelligible than using a constructor. -
Hi Experts,
Please let me know the use of forward declaration for a class. How to use that?
Thanks and Regards,
DebarshiHi,
Absolutely true matt...
you use forward declaration when you want to indicate that this component will be defined later but i am referring to this as of now.
so that it does not give any syntax/ run time error.
Rgds/Abhi -
No logical forward declared in action {0} in Web Channel
Hello
We are getting this error (No logical forward declared in action ) in CRM Web Channel when we are trying to retrieve a service order.
Any Ideas????Hello,
I would guess that this maybe due to come config in your struts-config.xml
I would check the f tansaction type that is been used and the transaction category
The only transaction category working with ICSS are:
- BUS2000116
- BUS2000120
- BUS2000112
Regards
Mark -
hi all,
can anyone explain me abt forward declarations in PLSQLForward Declaration:
A forward declaration consists of a subprogram spec terminated by a semicolon.
SQL> declare
2 procedure proc1(p1 varchar2);--Forward
3 procedure proc2 is
4 begin
5 proc1('Hai');--Used here without defining
6 end;
7 procedure proc1(p1 varchar2) is[b]--defined here
8 begin
9 dbms_output.put_line(p1);
10 end;
11 begin
12 proc2;
13 end;
14 /
Hai
PL/SQL procedure successfully completed. -
Receiving the warning of class forward declaration
I am trying to build the Clustering Plug in project on my Leopard. I have following 2 queries -
In that project an interface class is defined as
@interface ClusteringController : NSWindowController { ....... ..... .... } @end.
And this class is used in implementation class using forward declaration as follows
@class ClusteringController;
then in one fuction it is used as follows
(long) filterImage:(NSString*) menuName {
ClusteringController *cluster = [[ClusteringController alloc] init]; [cluster showWindow:self]; return 0; }
When i try to build this project it showing a warning as follows
warning: receiver 'ClusteringController' is a forward class and corresponding @interface may not exist
Also there is 1 more warning is coming
warning: no '-updateProxyWhenReconnect' method found
This warning is coming for the following line of code
if(delegate) [delegate updateProxyWhenReconnect];
Can anybody help me to overcome these warnings?shaktirsg wrote:
And this class is used in implementation class using forward declaration as follows
@class ClusteringController;
An implementation requires an #import of the entire interface file for any class used in the code. As a rule:
Use @class when a class is used in an @interface
Use #import when a class is used in an @implementation
if(delegate) \[delegate updateProxyWhenReconnect\];
warning: no '- updateProxyWhenReconnect' method found
It looks like the compiler doesn't know the class of 'delegate'. Can we see the code that sets the 'delegate' variable? Also please let us know where updateProxyWhenReconnect is declared. Is it declared in the interface for the class to which 'delegate' belongs? If so, it might be good for us to also see that @interface file.
\- Ray -
PLS-00323 forward declaration in PLSQL Version 10.
Hello.
I have a package which contains forward references which compiles on a 9i database.
However, when I try to compile an exact copy of the procedure on a 10g database it returns an error
"PLS-00323: subprogram or cursor 'P_PA_ACTION_START' is declared in a package specification and must be defined in the package body"
I was wondering if there were any differences in the rules concerning forward references in pl/sql 10.
Thanks in advance.
Glyn Williams.Hello.
I have a package which contains forward references which compiles on a 9i database.
However, when I try to compile an exact copy of the procedure on a 10g database it returns an error
"PLS-00323: subprogram or cursor 'P_PA_ACTION_START' is declared in a package specification and must be defined in the package body"
I was wondering if there were any differences in the rules concerning forward references in pl/sql 10.
Thanks in advance.
Glyn Williams. -
Hi There,
We have recently downloaded SDK 4 and had configured the same for
developement in flex builder 3, we are already using SDK 3.0. However
to our surprise there were compile time error reported for mx.chart
related classes. To resolve this we thought to import relevant .swc
like datavisualization, automation from sdk 3.0, and it worked and
resolved compile time error. But we landed up in on more problem that
is 'Declaration of style 'direction' conflicts with previous
declaration in E:\Softwares\FlexBuilder\sdks\SDK 4\frameworks\libs
\datavisualization.swc(mx/charts/GridLines)'.
If you could pleas help us to resolve these issues and also if you
could answer these queries would be good
1) SDK 4 has been declared to be open source, then why mx.chart
package is not part of it?
2) Why would 'Declaration of style 'direction' conflicts with previous
declaration' occur?
3) What are the other component and packages that are not part of open
source for which license is still required?
Waiting for reponse in anticipation.
Thanks,I got this same error with the following setup.
1. Building a SWC with Flex 4.0 Beta2 on FlashBuilder4
2. SWC references other SWC that are built with Flex3.
3. Define a <mx:ColumnChart id="column" ...> in a Flex4 skin.
4. Got this compiler error.
Any idea if this is not supposed to work? I'm hoping I don't need all referenced swcs to be recompiled with Flex4 SDK. Some of those are external dependency that I do not have source code access.
Thanks for any help.
kam -
I need to declare Item_To_Go_To package level variable stored in the Instace package for the below code.
I have create a a package specification in the form as a Program Unit named "Instance".
Now i need to declare Item_To_Go_To variable which will store control name like
Instance.Item_To_Go_To := 'myblock.myitem';
I have controls like text item, list item, Checkbox. How to declare these variables?
I have used the below one:
PACKAGE Instance IS
Item_To_Go_To item;
END;
In my example Instance.Item_To_Go_To := 'User.FIRST_NAME';
is giving expression is a wrong type error. Please let me know what i have done wrong.
I have used timer expired trigger to overcome my illegal restricted procedure Go_item issue.
Code snippet.
Declare
htimer Timer;
Begin
Instance.Item_To_Go_To := 'myblock.myitem';
Create_Timer( 'wvi_nav_timer', 1, NO_REPEAT);
End;
Then in the When-Timer-Expired trigger...
Begin
If ( Get_Application_Property( Timer_Name ) = 'wvi_nav_time' ) Then
Go_Item( Instance.Item_To_Go_To );
End If;
End;
Please refer:
Alternative trigger like post_change but can 'go_item'
Edited by: Chris90909 on Jun 12, 2009 12:27 PMAs you are trying to assign a varchar-value to the variable, you should declare it as varchar2 like:
PACKAGE Instance IS
Item_To_Go_To VARCHAR2(61);
END; -
ORA-04043 Error when oracle type is declared in a package
We have a package defining a type and a procedure which uses that type. The problem is - If the type is defined in a package jdbc fails with an error. If the type is declared outside the package everything works fine. The package is declared as
create or replace
PACKAGE TEST_ARRAY AS
TYPE COLTYPE_NUMTAB is table of number;
procedure Test_Procedure(some_var_name in COLTYPE_NUMTAB);
END TEST_ARRAY;My Jdbc call is made by declaring the type as "TEST_ARRAY.COLTYPE_NUMTAB".
Is there any different style/way of declaring this type?
ThanksI tried tracing the oracle jdbc driver logs (we use the OCI jdbc driver) for the success and failure scenarios. Here are the logs
1. When the type is defined outside the package the logs look like
2011-05-31T03:23:56.177+0530 UCP TRACE_1 seq-408,thread-10 oracle.jdbc.driver.PhysicalConnection.createARRAY Public Enter: "COLTYPE_NUMTAB", [Ljava.lang.Object;@16a9424
2011-05-31T03:23:56.177+0530 UCP TRACE_16 seq-409,thread-10 oracle.sql.ArrayDescriptor.createDescriptor Public Enter: "COLTYPE_NUMTAB", oracle.jdbc.driver.T2CConnection@180cb01
2011-05-31T03:23:56.177+0530 UCP TRACE_16 seq-410,thread-10 oracle.sql.ArrayDescriptor.createDescriptor Public Enter: "COLTYPE_NUMTAB", oracle.jdbc.driver.T2CConnection@180cb01, false, false
2011-05-31T03:23:56.177+0530 UCP TRACE_16 seq-411,thread-10 oracle.sql.SQLName.<init> Public Enter: "COLTYPE_NUMTAB", oracle.jdbc.driver.T2CConnection@180cb01
2011-05-31T03:23:56.177+0530 UCP TRACE_16 seq-412,thread-10 oracle.sql.SQLName.init Enter: "COLTYPE_NUMTAB", oracle.jdbc.driver.T2CConnection@180cb01
2011-05-31T03:23:56.177+0530 UCP TRACE_16 seq-413,thread-10 oracle.sql.SQLName.parse Enter: "COLTYPE_NUMTAB", [Ljava.lang.String;@1cec874, [Ljava.lang.String;@ca6cea, true
2011-05-31T03:23:56.177+0530 UCP TRACE_16 seq-414,thread-10 oracle.sql.SQLName.parse return: false
2011-05-31T03:23:56.177+0530 UCP TRACE_16 seq-415,thread-10 oracle.sql.SQLName.parse Exit
2011-05-31T03:23:56.177+0530 UCP TRACE_16 seq-416,thread-10 oracle.sql.SQLName.init Exit
2011-05-31T03:23:56.177+0530 UCP TRACE_16 seq-417,thread-10 oracle.sql.SQLName.<init> Exit
2011-05-31T03:23:56.177+0530 UCP TRACE_16 seq-418,thread-10 oracle.sql.ArrayDescriptor.createDescriptor Public Enter: SCHEMA_NAME.COLTYPE_NUMTAB, oracle.jdbc.driver.T2CConnection@180cb01
2011-05-31T03:23:56.177+0530 UCP TRACE_16 seq-419,thread-10 oracle.sql.ArrayDescriptor.createDescriptor Public Enter: SCHEMA_NAME.COLTYPE_NUMTAB, oracle.jdbc.driver.T2CConnection@180cb01, false, false2. When the type is defined inside the same package as the procedure which is TEST_ARRAY, the logs look like
2011-05-31T05:10:05.219+0530 UCP TRACE_16 seq-409,thread-10 oracle.sql.ArrayDescriptor.createDescriptor Public Enter: "TEST_ARRAY.COLTYPE_NUMTAB", oracle.jdbc.driver.T2CConnection@6a435f
2011-05-31T05:10:05.219+0530 UCP TRACE_16 seq-410,thread-10 oracle.sql.ArrayDescriptor.createDescriptor Public Enter: "TEST_ARRAY.COLTYPE_NUMTAB", oracle.jdbc.driver.T2CConnection@6a435f, false, false
2011-05-31T05:10:05.250+0530 UCP TRACE_16 seq-411,thread-10 oracle.sql.SQLName.<init> Public Enter: "TEST_ARRAY.COLTYPE_NUMTAB", oracle.jdbc.driver.T2CConnection@6a435f
2011-05-31T05:10:05.250+0530 UCP TRACE_16 seq-412,thread-10 oracle.sql.SQLName.init Enter: "TEST_ARRAY.COLTYPE_NUMTAB", oracle.jdbc.driver.T2CConnection@6a435f
2011-05-31T05:10:05.250+0530 UCP TRACE_16 seq-413,thread-10 oracle.sql.SQLName.parse Enter: "TEST_ARRAY.COLTYPE_NUMTAB", [Ljava.lang.String;@129c445, [Ljava.lang.String;@114a947, true
2011-05-31T05:10:05.250+0530 UCP TRACE_16 seq-414,thread-10 oracle.sql.SQLName.parse return: true
2011-05-31T05:10:05.265+0530 UCP TRACE_16 seq-415,thread-10 oracle.sql.SQLName.parse Exit
2011-05-31T05:10:05.265+0530 UCP TRACE_16 seq-416,thread-10 oracle.sql.SQLName.init Exit
2011-05-31T05:10:05.265+0530 UCP TRACE_16 seq-417,thread-10 oracle.sql.SQLName.<init> Exit
2011-05-31T05:10:05.265+0530 UCP TRACE_16 seq-418,thread-10 oracle.sql.ArrayDescriptor.createDescriptor Public Enter: TEST_ARRAY.COLTYPE_NUMTAB, oracle.jdbc.driver.T2CConnection@6a435fIn the second scenario the SQLName class constructor does not append the schema name.
Though I am not the right person to interpret the jdbc logs hope it helps in troubleshooting the problem. -
Multiple top level package declarations
The "Programming Adobe ActionScript 3.0" states in chapter 4 "ActionScript Language and Syntax", "Packages and Namespaces", "Creating Packages" that you can declare at the top level of a package multiple variables, functions, and namespaces in addition to a single class as long as only one is declared "public".
However, in Flash when I declare a public class and any other variable or function either with the "internal" attribute or no attribute, I get this error:
5006: An ActionScript file can not have more than one externally visible definition: test.function1, test.Test
The package code is as follows:
package test
internal function function1():String
return "Function1()";
public class Test
The same thing happens if I replace the function with an internal variable declaration. According to the manual, any declaration with the "internal" attribute should not be externally visible outside the package. Only the "public" class declaration should be externally visible.
Can anyone clue me in as to why I get this error?That is not the situation described by the quoted manual section that I am trying to recreate.
It clearly says:
"In ActionScript 3.0, you use the package statement to declare a package, which means that you can also declare variables, functions, and namespaces at the top level of a package. You can even include executable statements at the top level of a package. If you do declare variables, functions, or namespaces at the top level of a package, the only attributes available at that level are public and internal, and only one package-level declaration per file can use the public attribute, whether that declaration is a class, variable, function, or namespace."
The data properties and class you have decleared are outside the package within the ActionScript file, and not at the top level of a package. The "public" attribute is not available outside the package at all.
What I wish to know is why the quoted internal declarations at the top level of the package generate the quoted error.
However, I am beginning to believe that the documentation is in error and that what it is actually describing IS the situation you just described. When the manual says "top level of the package", it really means "top level of the ActionScript file outside the package", and when it says "the only attributes available at that level are public and internal", it really mans "the only attribute available outside the package declaration is internal. At the top level of the package, only one declaration may be made, it must have the same identifier as the ActionScript file name, and it can have either the public or internal attribute. Code within the same file but outside the package declaration can not access an internal declaration in the package declaration."
Actually, the whole paragraph would need to be re-written to clarify the issue and to unambiguously distinguish between "top level of a package" and "top level of an ActionScript file outside the package declaration".
As a concrete example - two ActionScript files:
MCTest.as is saved in the same directory as MCTest.fla, and the document class of MCTest.fla is set to "MCTest".
package
trace("MCTest package code.");
import flash.display.MovieClip;
import test.Test;
public class MCTest
extends MovieClip
trace("MCTest class code.");
function MCTest()
trace("Created Class MCTest: " + Test.StaticMessage);
trace("MCTest outside package code");
Test.as is saved in a sub-directory called "test".
package test
trace("test.Test package code");
public class Test
public static const StaticMessage:String = "Test: Hello World!";
trace("test.Test class code");
var myField:String = "myField";
function myFunction():String
return "myFunction";
trace("test.Test outside package: " + myField + ", " + myFunction() + ", " + test.Test.StaticMessage);
The resultant trace output is:
MCTest class code.
MCTest package code.
MCTest outside package code
test.Test class code
test.Test package code
test.Test outside package: myField, myFunction, Test: Hello World!
Created Class MCTest: Test: Hello World!
It is interesting to note that the package and outside package code are executed AFTER the class code.
That seems to make more sense. You can only declare one class, variable, function, or namespace at the top level of a package with the same identifier as the file name, public or internal, and you can include executable code. At the top level of the ActionScript file outside the package declaration, you can only declare internal classes, variables, functions, and namespaces, and you can include executable code, none of which are within the package nor have access to any package internal declarations.
The problem, therefore, would seem to be an incorrect manual. Does anyone actually know if this is accurate and the intended behavior? -
Hello, I am using TOAD to develop my "package". If I have Procedure A which calls Procedure B and Package B is placed in the package affter A, the package will not compile correctly. I do not really even get an error when it compiles, I just see a status that the package is invalid. But if I move B prior to A in the package order and recompile, the package compiles just fine. This leads me to conclude that order is important, but I am finding it difficult to believe that this is my only option. Is there some way that I can put the procedures in any order that I want and still compile the package successfully?
I've seen something about defining dependancies, but not sure it is related to this subject.
Any assistance you can provide would be greatly appreciated.Assuming you've got something like this:
CREATE OR REPLACE PACKAGE TEST AS
PROCEDURE A;
END TEST;and
CREATE OR REPLACE PACKAGE BODY TEST AS
PROCEDURE A
AS
BEGIN
B;
END A;
PROCEDURE B
AS
BEGIN
DBMS_OUTPUT.PUT_LINE('Hello, world!');
END B;
END TEST;you should get an error like:
PLS-00201: identifier 'B' must be declaredHowever, you can avoid this by adding a forward declaration of B (and any other "private" procedures used by your package) to the package body, as in something like this:
CREATE OR REPLACE PACKAGE BODY TEST AS
PROCEDURE B;
PROCEDURE A
AS
BEGIN
B;
END A;
PROCEDURE B
AS
BEGIN
DBMS_OUTPUT.PUT_LINE('Hello, world!');
END B;
END TEST;Then the order in which the procedures are defined should not matter.
Hope this helps. -
can anybody give me a clear cut idea, whether performance of oracle changes or remains same when a oracle package body created with forward declaration of sub programs than with out forward declaration.
Ex.
create package a as
procedure b;
procedure c;
end a;
create package body a as
procedure x;
procedure y;
procedure x is
begin
end x;
procedue b is
begin
procedure x;
end b;Could you give more explainations
Maybe you are looking for
-
Final Cut X playback on external monitor.
I am looking for a solution to be able to playback what is on my timeline for distribution on multiple monitors spread through out the building. Do I need another software to do this or can I use a traditional VGA cable to display my project full scr
-
Is there a maximum number of "multi state objects" per article? Indesign keeps crashing
Hi, i have 12 multi state objects on a page, and indesign keeps crashing. i know this seems like a high number, but I have done this to create a work around - ticker (like an old style airport board e.g. https://www.google.co.uk/search?q=airport+boar
-
well i want to do the impossible- i think. i want to know if i there is an app that will allow me to use my iphone as a microphone, for the iphone to be able to be connected to a wireless bluetooth speaker, and for the sound, to come out on the speak
-
I have taken a few videos on my phone, some of them show in the photos preview screen, however, some of them just show a grey mov as the preview. Also the video, slide bar at the top is green as appose to the video in a clip format. Is there somethin
-
Hello world! Juste a question. No. Two questions about the menu. 1– I made the menus bigger. So, the text isn't in the center of the bloc anymore... I can't align it to the middle of the block... (image) 2– And second problem, when we go to the edit