PLSQL packages with procedures in data dictionary [duplicate] - sql

This question already has answers here:
How to get list of all the procedure inside a package oracle
(4 answers)
Closed 8 years ago.
How can i get list of packages with their procedures inside, with help of data dictionary views?
I need to get this list for a user lets say 'HR' , and to be listed like:
PackageName1: Procedure1, Procedure2,...
PackageName2: Procedure1, Procedure2,...
I used this line statement but i couldn't figure out how to get procedure lists inside of those packages:
select distinct name, type
from all_source
where owner ='HR'
and type='PACKAGE';

You can use this answer to get packages and procedure details
How to get a list with description of all dba packages
to get idea how to extract info
and then reformat output using LISTAGG function

Related

Got 'Enter values for precautions" popup in Oracle Developer [duplicate]

This question already has answers here:
How to avoid variable substitution in Oracle SQL Developer
(5 answers)
Closed 1 year ago.
I'm using Oracle Developer to execute the SQL queries. I got this popup:
Enter value for precaution
when I'm trying to execute an insert query. Does anyone know why I'm getting this popup?
It would be simpler to answer if you posted statement you ran.
Meanwhile, that's probably because insert contains & which indicates a bind variable. Something like this:
insert into test (name) values ('Is this what&precaution?');
What to do? Run set define off first, then run the insert.

Is it possible to create sp with an integer array parameter in Sql Server? [duplicate]

This question already has answers here:
How to pass an array into a SQL Server stored procedure
(13 answers)
Closed 2 years ago.
I want to call a stored procedure from a Web Api controller. As a parameter i need to pass id's of items to the sp but id count is not stable. For a case i may pass 3 ids for another it may be 10 ids. Is it possible to pass an array or list of numbers to a stored procedure.
Use a Table-Valued Parameter, JSON, or XML.

Copy all columns without data but with dependencies in SQL [duplicate]

This question already has answers here:
In SQL Server, how do I generate a CREATE TABLE statement for a given table?
(16 answers)
Closed 5 years ago.
So i'm trying to copy all data of table CarOrders into a new table, NewCarOrders. But i only want to copy columns and dependencies and not data. I don't know if it truly matters, but i'm using SQL Server Management Studio.
Here are two things that i tried, but none worked.
SELECT *
INTO NewCarOrders
FROM CarOrders
WHERE 0 = 1
The issue with above is, it is copying all the columns but it is not copying the dependencies/relationships.
I saw some posts on some of the forums regarding this, but the suggested solution was using SSMS Wizard. I want to do it using SQL (or T-SQL).
I'm new to SQL world, so i'm really sorry if it is a stupid or no brainer question. Let me know if i am missing some important information, i'll update it.
Try below query and check if this works for you
SELECT TOP 0 *
INTO NewCarOrders
FROM CarOrders
This will create NewCarOrders table with same structure as CarOrders table and no rows in NewCarOrders.
SELECT * FROM NewCarOrders -- Returns zero rows
Note : This will not copy constraints , only structure is copied.
For constraints do as below -
In SSMS right click on the table CarOrders, Script Table As > Create To > New Query Window.
Change the name in the generated script to NewCarOrders and execute.
Also change the constraints name in the generated script else it will throw error like There is already an object named 'xyz' in the database
You can use the like command:
CREATE TABLE NewCarOrders LIKE CarOrders;

How to Check the given string is a reserved keyword in sql server [duplicate]

This question already has answers here:
Check if string is SQL Server Reserved Keywords or not
(3 answers)
Closed 8 years ago.
How to check whether the given string is a reserved keyword in sql server.
I checked a lot in google ,but i didn't find one!!
for eg: If i am giving the input String as 'Order',sql statement should
return whether it is reserved keyword.
Is there any built-in stored procedures or function to do this? Any help would be appreciated.
There is no built-in function to do that.
Here is the list of the known identifiers.
http://technet.microsoft.com/en-us/library/ms189822.aspx
I suggest to put these in an table and use it in a function / stored procedure.

IS vs AS keywords for PL/SQL Oracle Function or Procedure Creation [duplicate]

This question already has answers here:
What is the difference between "AS" and "IS" in an Oracle stored procedure?
(6 answers)
Closed 9 years ago.
I have been trying to find out what the difference is between the IS and AS keywords in PL/SQL when creating an Oracle function or procedure.
I have searched and have been unable to find any information on this. Does anyone know the difference?
I've never known there to be a difference. The Oracle documentation implies that they are synonyms:
The function body begins with the keyword IS (or AS) and ends with the keyword END followed by an optional function name.
Same as DISTINCT and UNIQUE in select statements.
i.e, there is no material difference between 'IS' and 'AS'.
Backwards compatibility and meeting standards