Private procedures and functions
Hi allI am struggling to find a way to the list of private procedures and functions that are not declared in the package specification.
Are there data dict. table or a view that could help
DBA_procedures only the list procedure and functions that are declared in the package Spec.
Thanks in advance.
This is what the intended behavior is that if the procedure /function is prviate, it must not be visible. Have you tried to check in dba_source ?
Aman...
Tags: Database
Similar Questions
-
differences between the procedures and functions.
a little confusing... differences between procedures and functions...
1. a function returns only the unique value? can't return us multiple values?
2. can we use clause of 'back' and 'out' parameter at the same time in the same function
Thank youHello
Simply create a TYPE for strong cursors, returning the specified columns. For genereic, or the low sliders, there is a TYPE integrated, namely SYS_REFCURSOR.
Try this:
CREATE OR REPLACE function test_f(p_DEPTNO in emp.DEPTNO%type) return SYS_REFCURSOR as REF_C SYS_REFCURSOR; BEGIN OPEN REF_C FOR SELECT * FROM EMP WHERE DEPTNO = P_DEPTNO; RETURN REF_C; END;
You don't want to close the cursor service.
Always format your code.
-
What is the difference between procedure and function?
Hello
I want to know the difference between procedure and function.
Also, I want to know the types (if any) of procedures and functions.
ConcerningA function requires a return value.
A procedure, while allowing the option PARAMETERS, mandates without return.
-
How to use the type of packages, procedures and functions in another schema?
I have two schema target in an OWB project, such as A and b. In a map of A, I would use some packet types, functions and procedures of B. I tried the method of the suggested such synonym, but I couldn't find the metadata of these when importing... The only type of synonym I can import is the synonym for the table. Y at - it a bug for synonym?
If I can't use a synonym for that matter, is there another way to solve the problem?Now, in some cases you will absolutely need to create the second module as Carsten described, but it should also be noted that you can reference objects in things like Expressions even if you have not loaded the metadata. It's only when you need strong bonding that it becomes necessary to import objects. For everything else, as long as the reference can solve during the compilation so you are good to go.
For example, I target a function in a schema (S1) and a synonym private that it in another (s2). A mapping of the S2 schema has an expression object that uses the synonym of the function in the expression property for a couple of the attirbutes of output. The synonym has not been loaded in metadata - OWB has indeed no knowledge of its existence. But she is resolved at compile time if the mapping validates and generates successfully.
Mike
-
Variable binding in the procedure and function
Hello
I started reading ORACLE 11 g R2 PL/SQL programming doc and I'm stuck to bind the variable. I just copied the example in the books and found error-
First of all, I wrote the procedure below and compiled with - success
Then I wrote below function and also compiled successfully-CREATE OR REPLACE PROCEDURE FORMAT_STRING ( string_in IN OUT VARCHAR2) AS BEGIN string_in := '[' || string_in || ']'; END FORMAT_STRING;
Later, I wrote the code below in the SQL Editor and found the ORA-00900 error. Please help me to understand.create or replace function join_strings (str1 varchar2, str2 varchar2) return varchar2 is begin return str1||' '||str2||'.'; end;
Maoulidavariable session_var varchar2(200) call join_strings ('I Love','you') into :session_var; call format_string(:session_var);
Later, I wrote the code below in the SQL Editor and found the ORA-00900 error. Please help me to understand.
variable session_var varchar2(200) call join_strings ('I Love','you') into :session_var; call format_string(:session_var);
If you want to do it in PL/SQL, you can use an anonymous PL/SQL block like that.
set serveroutput on declare session_var varchar2(200); begin session_var := join_strings ('I Love','you'); format_string(session_var); dbms_output.put_line(session_var); end; /
If you want to run directly in SQL Plus you can do
var session_var varchar2 exec :session_var := join_strings ('I Love','you') exec format_string(:session_var) print session_var
-
PL - SQL procedures and functions
Hi all
When playing on the PL - SQL procedures, I came across a concept, which says that we cannot include bind or host variables in procedures because the compiler cannot resolve the reference to bind the variable.
Can someone please explain more carefully.
Thank you.983037 wrote:
When playing on the PL - SQL procedures, I came across a concept, which says that we cannot include bind or host variables in procedures because the compiler cannot resolve the reference to bind the variable.
Fix. This code cannot compile the way he needs to a connection variable to respect:
create or replace function GetEmpName return varchar2 is empName emp.ename%Type; begin select e.ename into empName from emp where emp_no = :BIND_VARIABLE; return( empName ); end;
Stored code cannot include bind variables as what compiler Oracle to know the data type of +: BIND_VARIABLE + - or run the service running when the code is already compiled, but it lacks a bind call to provide a value for +: BIND_VARIABLE +?
If the code should look like the following instead:
create or replace function GetEmpName( empID number ) return varchar2 is empName emp.ename%Type; begin select e.ename into empName from emp where emp_no = empID; return( empName ); end;
The variable from PL/SQL empID is treated (transparent) as a variable binding when the SQL SELECT in this function is parsed and executed as a SQL cursor.
You as a visitor, however need to provide variable bind when you call this function from an external client (such as SQL * Plus, Java, C/C++, etc.). For example
--// using sqlplus as example - create 2 sqlplus host variables var name varchar2(100) var id number --// assign a value to a host variable exec :id := 12345; --// execute the stored function code binding host variables as bind variables begin :name := GetEmpName( :id ); end; / --// display host variable print name
-
General question about the procedures and functions
Hello!
I know, I can define and use a function within a procedure. But can I set up and use a procedure inside a procedure?
Thank you!Hello
But can I define and use a procedure inside a procedure?
HMMM... was it so difficult to test this?
CREATE OR REPLACE PROCEDURE xy_main AS PROCEDURE xy_sub IS BEGIN NULL; END; BEGIN xy_sub; END;
Or you actually meant the procedure inside a function
It's also not difficult :)CREATE OR REPLACE FUNCTION func_xy_main RETURN NUMBER IS PROCEDURE xy_sub IS BEGIN NULL; END; BEGIN xy_sub; RETURN(1); END;
See you soon!
Bobin -
Call a procedure and a function over a db link
I feel a few errors with the following and would be very happy in the view of some experts here.
My use case is to insert records into a table via a database link. Inserted records will be interviewed for a same table in the local data dictionary. Everything works, but sometimes, I get a unique constraint violation if I'm trying to insert a duplicate record, so I wrote a simple function to check for the scenario. My problem is that I can run my procedure using the link to the db and I can run my function using the db link, but I can't use the two together without errors.
My test scenario uses only the standard emp table:
create or replace procedure test_insert(p_instance varchar2) IS l_sql varchar2(4000); begin l_sql := 'insert into EMP@'||p_instance||' (EMPNO, ENAME, JOB, MGR, SAL, DEPTNO) (Select EMPNO, ENAME, JOB, MGR, SAL, DEPTNO from EMP)'; execute immediate l_sql; END;
BEGIN test_insert('myLink'); END;
It works very well and the insert occurs without any problem.
If I run the same process a second time, I get:
00001 00000 - "forced single (s.%s) violated" which is what I've been waiting for EMPNO has a unique constraint. So far so good.
Now, I create a function to check if the record exists:
create or replace function record_exists(p_empno IN NUMBER, p_instance IN varchar2) return number IS l_sql varchar2(4000); l_count number; BEGIN l_sql := 'select count(*) from EMP@'||p_instance||' where empno = '||p_empno; execute immediate l_sql into l_count; IF l_count > 0 THEN return 1; ELSE return 0; END IF; END;
I test this situation as follows:
select record_exists(8020, 'myLink') from dual;
RECORD_EXISTS(8020,'myLink')
-------------------------------------------
1
That works well, so now I'll add this feature to my procedure:
create or replace procedure test_insert(p_instance varchar2) IS l_sql varchar2(4000); begin l_sql := 'insert into EMP@'||p_instance||' (EMPNO, ENAME, JOB, MGR, SAL, DEPTNO) (Select EMPNO, ENAME, JOB, MGR, SAL, DEPTNO from EMP WHERE record_exists( EMPNO, '''||p_instance||''') = 0)'; execute immediate l_sql; END;
I test this situation as follows:
BEGIN test_insert('myLink'); END;
As a result:
Error report: ORA-02069: global_names parameter must be set to TRUE for this operation ORA-06512: at "FUSION.TEST_INSERT", line 6 ORA-06512: at line 2 02069. 00000 - "global_names parameter must be set to TRUE for this operation" *Cause: A remote mapping of the statement is required but cannot be achieved because global_names should be set to TRUE for it to be achieved *Action: Issue alter session set global_names = true if possible
I don't know why I'm getting this. The function works, the works of the procedure, but when I combine I get an error. If I set the global setting to true names and then run again I get:
02085. 00000 - "database link %s connects to %s" *Cause: a database link connected to a database with a different name. The connection is rejected. *Action: create a database link with the same name as the database it connects to, or set global_names=false.
All opinions are appreciated. I do not understand why I can run the procedure and function of each separately on the db connection, but they don't work together.
Thank you
John
The procedure depends on what how would you define failure and it should mean - error to the caller, sign and continue, just continue. Constraints are created to ensure if it receives no invalid data in a table. Generally, they provide the most effective mechanism for the verification of the invalid data and return useful exceptions that can deal with the appellant. You also double the workload of the checking uniqueness by adding your own control.
In general I would say use Exceptions, they are your friend
-
Stored procedure and stored function
Greetings from a newbie,
Question about procedure and function:
When we use procedure and function? What is the difference between the two?
Kind regards
Valerie
Published by: Valerie debonair on August 24, 2009 21:27When we use procedure and function?
If you need to compute and value, good idea to use the function to return.
If you need data DML, good idea to use the procedure...What is the difference between the two?
A FUNCTION is always returns a value using the return statement.
A PROCEDURE can return one or more values through parameters or may not return at all. -
How do you know that a spesific procedure or function has been run by the user who and when?
Hi allSuppose I have a procedure or a function whose name is MY_PROC. Is it possible to learn that the user who has been running this procedure and when?
Thank you
Hi NightWing,
You need VERIFICATION for operations.
11.2 docs: AUDIT
For example:
SQL> show parameter audit_trail; NAME TYPE VALUE ------------------------------------ ----------- ------------------------------ audit_trail string DB SQL> SQL> conn iarsov/iarsov Connected. SQL> create or replace function test_audit 2 return date 3 is 4 begin 5 return sysdate; 6 end; 7 / Function created. SQL> conn system Enter password: Connected. SQL> audit execute on iarsov.test_audit by access; Audit succeeded. SQL> select os_username,username,obj_name,owner from dba_audit_trail where obj_name = 'TEST_AUDIT'; no rows selected SQL> conn iarsov/iarsov Connected. --call the function and trigger audit operation SQL> select test_audit from dual; TEST_AUDI --------- 04-AUG-14 SQL> conn system Enter password: Connected. SQL> select os_username,username,obj_name,owner,timestamp from dba_audit_trail where obj_name = 'TEST_AUDIT'; OS_USERNAME USERNAME OBJ_NAME OWNER TIMESTAMP -------------------- ------------------------------ -------------------- -------------------- --------- oracle IARSOV TEST_AUDIT IARSOV 04-AUG-14
Kind regards
Ivica
-
Function procedures and triggers
Sorry to ask this question,
In oracle. We use the function of triggers and procedures.
for example:
If we wrote a trigger for a table. It fires both to manipulate the table. (database table contains data and database also contains triggers the same function, procedure).
but my questions?: is
In my database, I have not kept only tables. No trigger, no function, no procedures. and
I kept this triggers, function, procedures of data instead of I want kept this function, triggers, procedures in layers of logic (intermediate level)
is it possible? .
If yes means, how to write or where to write? Please help me, otherwise send guidance documents or the blog releated to it.Hi Marie Laura,.
If you want to call the procedures used the following link
http://www.techartifact.com/blogs/2009/04/procedure-calling-in-Oracle-ADF.htmlfor my statement
all logic, triggers can be done using java classes that is attached with the business objects.
This means... in the procedure, you have selection, insertion, updating, and deleting of records in a table...
So map complete things as an object adf...Tables-> object EO
Select the statement - > VO objects
Insert, update, deletion - crud-> dodML() operation, the remove() method in EntityImpl
commit - dbTransaction.commit)
other features... are also can be mapped to specific files, and can be represented as objects adf...That's what I wanted to say, convert the whole procedure into objects of the adf and work on...
I hope you understand now... -
How to query the DDL lock functions or stored procedures and packages?
Hello!
The subject says it all: how to display existing DDL locks on the functions or stored procedures and packages?
While running a procedure, it cannot be deleted or replaced, so there must be a DDL lock on it. The information does not seem to be in V$ LOCK or V$ LOCKED_OBJECTS.
Thank you!
Marcus
Published by: David on November 21, 2009 15:43Hello
You have the DBA_DDL_LOCKS view.
Best regards
Jean Valentine -
Why we need to create the package instead of procedure or function in Oracle
Hello
Recently, I attended an interview, they asked,
why we must create the package instead of procedure or function in oracle. Is a specific advantage, if we create together.
I'm not sure. can u tell me please someone.
Thank you and best regards,
Sanjeev.Hello
A part of the oracle documentation.
What is a PL/SQL Package?
A package is a schema object which includes subroutines, variables, and logically related PL/SQL types. Packages have two parts: a specification (spec) and a body. Sometimes, the body is unnecessary. The specification is the interface to the package. It declares the types, variables, constants, exceptions, cursors, and subprograms that can be referenced from outside the package. The body defines queries for the sliders and the code for the subprogrammes.Benefits of the PL/SQL Packages
Packages have a long history in software engineering, offering important characteristics for a reliable, maintainable, and reusable code, often in team for large systems development efforts.Modularity
Packages allow you to logically encapsulate Associates types, elements, and subroutines in a module named PL/SQL. Each package is easy to understand, and the interfaces between packages are simple, clear and well defined. This facilitates the development of applications.
Easier application design
When you design an application, all you need initially is the interface information in the package specification. You can code and compile a spec without his body. Stored subprograms that reference the package can then be compiled as well. You should not set the package body entirely until you are ready to complete the application.
Information masking
With packages, you can specify which types, elements, and subprogrammes are (and accessible) public or private (hidden and inaccessible). For example, if a package contains four subprogrammes, three can be public and one private. The package hides the implementation of the subprogramme private so that only the package (not your application) is affected if the application changes. This simplifies maintenance and improvement. Also, by hiding the implementation details of the users, you protect the integrity of the packaging.
Feature added
Sliders and packed public variables persist for the lifetime of a session. They can be shared by all the subprogrammes that are running in the environment. They allow you to manage data in any of the transactions without storing in the database.
Best performance
When you call a subprogram packaged for the first time, the whole package is loaded into memory. Subsequent calls to related subprograms in package require no disk i/o.
Packets stop cascading dependencies and avoid an unnecessary recompilation. For example, if you change the body of a packaged function, Oracle does not recompile other routines that call the function; These routines only depend on parameters and return value that are declared in the specification, so they are recompiled only if the specification changes.
-
SG300 series Switch - #Unknown # procedure or function: free?
Hi all
Does anyone know what "##Unknown procedure or function: free" means on a series of SG300 switch? (as below)
Also, I want to create a model of configuration, change and mass file to deploy it... What is the best way to do it on a switches 300 series? They do not seem to behave like the Cisco IOS products when it comes to change and download config files.
Switch software version:
v1.3.0.62 / R750_NIK_1_3_647_260
CLI v1.0 v1.3.0.62 / R750_NIK_1_3_647_260
CLI v1.0!
interface gigabitethernet13
IP-Phone & PC description
activate the storm control
Storm-control broadcast level 10
Storm-control include multicast
maximum port security by 10 points
port security mode max-addresses
port security throw trap 60
spanning tree portfast
switchport trunk allowed vlan add 100
LLDP-med network-strategy to add 1Procedure or function ##Unknown: free
!
Thanks in advance for any help...
Matt
Hi Matt, I wasn't looking to recreate because I think I know the problem, that goes back to my initial suspicion.
You have many things going on, basically, I think you're too smart for your own good.
- If you have car insurance, you don't need to manually tag the VLAN, so your config from port to manually set 100t can be breaking stuff
- You have the policy of lldp attributed to the port assigned by the voice of the auto
To make this as painless as possible, I would like to switch (back out config is boring and takes too long in my opinion).
Use this document for the LLDP-MED
https://supportforums.Cisco.com/docs/doc-27005
It must be remembered that automatic speech depends on the protocols of discovery as the cdp and lldp. These auto policies don't produce any results or undesirable if already manually set you the parameter. The switch performs a basic QoS for the CoS and DSCP to tag packets, so that is why everything is basically done twice - or more based on this config.
-Tom
Please mark replied messages useful -
How to know the name (package, procedures or functions) for current sessions
Hi all
I am DBA and I want to find a way to get the object name regardless (packages, procedures or functions) for the current statement running in the current session.
To specify when I open the browser session of Toad, I can see the active sessions and the current statement for each session, but without the name of the object.Is it possible to know this point.Thanks in advanceSelect *.
from dba_objects
When object_id in (select nvl (t.PLSQL_ENTRY_OBJECT_ID-1)
v $ session t
where sid = 452)
-----
Ramin Hashimzade
Maybe you are looking for
-
What is the difference between firefox for os android and firefox
Difference between bones of firefox and firefox for android
-
Why my system restore says it can't restore my system?
Original title: WHY MY SYSTEM RESTORE WOULD say IT can NOT RESTORE any date choose it says it cannot restore, I did the cleaning disc and defragmented, did not anygood
-
Automatic update of Windows will reboot you computer automatically within a few minutes from 15:00 How to stop this message while I'm working? I don't mind using the automatic update, but I don't like having to click this message all night while I'm
-
Why has my Inbox & all folders in OE6 disappeared today?
I am completely current with my NAV updates/weekly scans, monthly checkdisk and defrag so I doubt that's the issue. It was working fine this morning & then all of a sudden, the Inbox disappeared from the Outlook bar & when I tried to check other fol
-
Uninstall windows vista and go back with my computer came with.
Uninstall windows Vista Home Basic and come back with what my computer came with.