How to run an arbtrary sql in a DB or ST transacation
I know in some DB or ST transaction, one can run an arbitray sql. Can someone provide the transaction and detail on how to do it. Thanks a lot.,
Hi Fidel,
mainly that's true - but it works for some tables against the ABAP data dictionary
(i.e. you have to check some values from SAPR3 tables against data dictionary views:
Here I use RSTODS ( a BW table stroing ODS table information) as an input source for my IN clause on a DBA table in RSORADVJ to know the exact partition counts on every ODS table.
Ex.:
select table_name,
replace(To_char((sum(blocks) * 8192) / 1024/1024,'99999.99' ),'.',',') Mbyte,
sum(num_rows) numrows, sum(blocks) blocks ,
count(*) num_part
from dba_tab_partitions " <--------------------------- Oracle dict table
where table_owner ='SAPR3' and
TABLE_NAME in
( select odsname_tech from rstsods) " <----------------- BW table
group by table_name having ((sum(blocks) * 8192) / 1024/1024) >= 1
order by blocks desc
ok - it's somewhat limited what you can do (and it may a feature or a security bug )
but it works for me
bye yk
Similar Messages
-
How to run a pl/sql stored procedure as a concurrent program
Hi All,
I created a package PURGE_DEAL_REQUESTS. It contains a procedure QPR_DELETE_CANCELLED_REQUESTS. I want to run this stored procedure as concurrent program in ebs suite....
Can anyone tell me how to run this procedure as a concurrent program(in ebs suite).....?
Thanks
Swathi.You need to add the concurrent program to the group of the responsibility that will run the report. For more details, please refer to:
Note: 73492.1 - Creating a PL/SQL Concurrent Program in Oracle Applications
https://metalink2.oracle.com/metalink/plsql/ml2_documents.showDocument?p_database_id=NOT&p_id=73492.1
Note: 133991.1 - How to Register a Custom Report
https://metalink2.oracle.com/metalink/plsql/ml2_documents.showDocument?p_database_id=NOT&p_id=133991.1 -
How to run a PL/SQL package procedure
I can run a procedure in Jdeveloper 9.0.3, but How can run a procedure of a package not using SQL*PLUS
You can run a procedure or function in a package the same way you run a top level procedure or package. Select the package containing the procedure in the navigator and select 'Run' from the context menu. In the Run PL/SQL dialog, select the procedure/function you wish to run from the list in the top left-hand side.
- John McGinnis
Oracle JDeveloper Team -
How to run a single sql statement
I want to run a simple sql statement to get some data in my Controller or AM.
Is there some way, other than creating a VO with the SQL statement, to get some data from the database. My sql query will always return a single row.Hi,
here you have an example I use to call a function in a package (note how you can pass parameters and read results):
Connection conn = this.getOADBTransaction().getJdbcConnection();
OracleCallableStatement ocs = null;
String param = null;
try {
String stmt = "BEGIN :1 := <PkgName>.<FunctionName>(:2); end;";
ocs = (OracleCallableStatement)conn.prepareCall(stmt);
ocs.registerOutParameter(1, OracleTypes.CHAR);
ocs.setString(2, <param>);
ocs.execute();
param = ocs.getString(1);
} catch(SQLException se) {
throw OAException.wrapperException(se);
finally {
try {
ocs.close();
return(param);
} catch(Exception e) {
throw OAException.wrapperException(e);
}Hope this helps you
Bye
Raffy -
How to run procedure in sql navigator?
Hi,
Can anyone tell me how can i run stored procedures in a package from SQL NAVIGATOR?
Thank youIf there are no OUT-Parameters just
exec <package_name>.<procedure_name>
as it´s done in SQL*Plus.
Regards,
Gerd -
Hi
how run sql scripts for example see below,
For Release 12+, i2471362.sql is delivered with the release with version 120.0
The module can be found in $INV_TOP/patch/115/sql
Run i2471362.sql periodically to clean-up orphaned rows in the MTL_DEMAND and MTL_RESERVATIONS tables.
any idea
thanksHi,
As applmgr/oracle user, login to SQL*Plus (as APPS user) and run the script.
$ sqlplus apps/<apps password>
SQL> @i2471362.sqlStandard Cleanup Scripts for INVDVDSD - SUPPLY/DEMAND in 11.5.10.2, 12.0 and 12.1 [ID 372170.1]
11i/R12: Clean Up Scripts - Inventory Reservations Not Relieved for Closed Sales Orders [ID 199887.1]
MRPRPROP - Reorder Point Report Shows Incorrect Data In Open Demand Qty [ID 300260.1]
Thanks,
Hussein -
How to run @d:\emp.sql from Oracle Procedure
Dear All experts
Help me in executing a sql file containing simple insert statements. This file is being run on SQL prompt
by the flowing command.
@d:\emp.sql;
But i want run it through procedure.
@d:\emp.sql
Thanks.A stored procedure does not normally invoke external SQL scripts. Stored procedures run on the database server and should only be calling objects created in the database. So I would strongly suspect that you need to rethink your architecture.
If you are determined, however, you could potentailly
- Put the .SQL file on the database server
- Create a Java stored procedure that calls out to the operating system
- Have that Java stored procedure invoke SQL*Plus and pass SQL*Plus the name of your .SQL file
- Call that Java stored procedure from your stored procedure
This would, of course, be a highly convoluted architecture, which is why the right answer is probably to rethink things.
Justin -
How to run procedure from SQL Commands
I have tried several ways, for example:
EXECUTE POPULATE_HIERARCHY(121121);
but I get the error: ORA-00900: invalid SQL statement.BEGIN
POPULATE_HIERARCHY(121121);
END; -
How to run my PL/SQL function?
I have 4 table
1st is EMPLOYEE(E#, ENAME), Primary Key is E#
2nd is DRIVER(E#,L#), Primary Key is E# ref EMPLOYEE
3rd is TRIP(T#,L#), Primary Key is T#, foreign key L# from DRIVER
4th is TRIPPT(T#,PT#) Primary Key is T# from TRIP
I have create a Function that finds the length(total number of pt#) of the longest point perform by the driver
create or replace function LONGPT (DL# in TRIP.L#%type)
return TRIPPT.PT#%type
IS
TRIPPT# TRIPPT.PT#%type;
begin
select max (PT#)
into TRIPPT#
from TRIPPT
where T# in (select T#
from TRIP
where L# = DL#);
return nvl (TRIPPT#, 0);
end LONGPT;
/ How can i do a select query to display the NAME of the employee, LONGPT. The Driver name that perform no trip point need to be in the query as well.
I have try
SELECT DRIVER.L# AS License_No, LONGTPT(TRIP.L#) AS "LONGEST POINT"
FROM DRIVER
LEFT OUTER JOIN TRIP on DRIVER.L# = TRIP.L#;
This only query the L# and the LONGEST Point. Could anyone guide me how to do the select statement on display the ENAME and with my function LONGPT.
Edited by: user4757127 on Nov 25, 2012 10:11 AM
Edited by: user4757127 on Nov 25, 2012 10:17 AM
Edited by: user4757127 on Nov 25, 2012 10:18 AMHi,
Welcome to the forum!
user4757127 wrote:
... How can i do a select query to display the NAME of the employee, LONGPT. The Driver name that perform no trip point need to be in the query as well.I'm not sure what you mean by "the employee, LONGPT".
My best guess is that you need to join the employee table into your current query:
SELECT driver.l# AS License_No
, employee.ename -- ***** NEW *****
, longtpt (trip.l#) AS "LONGEST POINT"
FROM driver
JOIN employee ON driver.e# = employee.e# -- ***** NEW *****
LEFT OUTER JOIN trip ON driver.l# = trip.l#
;Again, this is just a guess, and guessing isn't always the best way to solve problems.
I hope this answers your question.
If not, post a little sample data (CREATE TABLE and INSERT statements, relevant columns only) for all the tables involved, and the results you want from that data.
Explain, using specific examples, how you get those results from that data.
Always say what version of Oracle you're using (e.g. 11.2.0.2.0).
See the forum FAQ {message:id=9360002} -
How to run .sql file in tsql or powershell
Hi All,
HOw to run .sql file inside the TSQL or powershell using with IF else condition. This below query works fine but when i executing through the SQL Agent it's geeting an error.Please could help how to run through the SQL agent already using execution type
in agent as 'Operating system(CmdExec)'
Declare @computerName varchar(100), @InstanceName varchar(50)
SET @ComputerName = REPLACE(CAST(SERVERPROPERTY('ComputerNamePhysicalNetBIOS') AS varchar),'\','$')
SET @InstanceName = REPLACE(CAST(SERVERPROPERTY('instancename') AS varchar),'\','$')
IF (@InstanceName = 'SQL2008R2')
Begin
:r C:\BackupFolder\Test1.sql
:r C:\BackupFolder\Test2.sql
End
IF (@InstanceName = 'SQLINS2')
BEGIN
:r C:\BackupFolder\Test3.sql
END
IF (@InstanceName = 'SQL2012')
BEGIN
:r C:\BackupFolder\Test4.sql
END
Thansk in Advance
A-ZSQLIn T-SQL, you can try using sqlcmd to invoke sql file
if @@SERVERNAME='abcd'
begin
Master..xp_cmdshell 'sqlcmd -S <ServerName> -i BackupDetails.sql -E'
end
OR
PowerShell
Load the snapins
Add-PSSnapin SqlServerCmdletSnapin100
Add-PSSnapin SqlServerProviderSnapin100
Function Get-SqlInstances {
Param($ServerName = '.')
$localInstances = @()
[array]$captions = gwmi win32_service -computerName $ServerName | ?{$_.Name -match "mssql*" -and $_.PathName -match "sqlservr.exe"} | %{$_.Caption}
foreach ($caption in $captions) {
if ($caption -like "MSSQLSERVER") {
$localInstances += $ServerName
} else {
$temp = $caption | %{$_.split(" ")[-1]} | %{$_.trimStart("(")} | %{$_.trimEnd(")")}
$localInstances += "$ServerName\$temp"
$localInstances
$instance=Get-SqlInstances -ServerName HQDBSP17
foreach($i in $instance)
if($i -like 'CRM2011')
write-host 'CRM Database'
invoke-sqlcmd -inputfile 'F:\PowerSQL\test.sql' -ServerInstance 'abcd'
if( $i -like 'SQL2012')
write-host 'SQL 2012 instance'
invoke-sqlcmd -inputfile 'F:\PowerSQL\test.sql' -ServerInstance 'abcd'
--Prashanth -
Hi
eBS
DB: 11.1.7
APS: R12.1.2
Does anyone who can guide me how to run script for .sql
I need command on how to execute this |
Run the script poxrespo.sql in the PO_TOP/sql directory
ThanksDoes anyone who can guide me how to run script for .sql
I need command on how to execute this |
Run the script poxrespo.sql in the PO_TOP/sql directoryConnect as apps user to SQL*Plus as run the script.
Make sure COMMIT is issued -- Release Notifications Error - ORA-20002 2018 Unable To Generate The Notification Content [ID 342734.1
Thanks,
Hussein -
How to run a sql script in oracle forms
Hi,
For me there is an sql script. I need to run that sql script in forms.
Actually we will run that sql file in pl/sql developer by giving @and the file name.
But how to run that file in forms.
Can any one help on these.Which book I have to look.
ThanksActually there is a script files which will drop all the indexes and tables.
DROP querry will be there for each index and each table.
So I run the script all the indexes and all the tables will be deleted. So using forms I have to run that script.
Thanks -
How to run sql query in bat file in task schedular at every 10 seconds
This is my sql script :
DECLARE @countRows INT,
@currDate DATE,
@checkForTasks INT,
@created_by_id INT,
@gst_ID int;
SET @currDate = Getdate()
SET @countRows = (SELECT Count(*)
FROM [dbo].[sd_gst_effective_table]
WHERE isapplied = 0)
IF @countRows > 0
-- Check for those GST''s who are not applied yet : if they are greater than 0 then perform next task
BEGIN
SET @checkForTasks = (SELECT Count(*)
-- Check is current date equals to task date or not
FROM [dbo].[sd_gst_effective_table]
WHERE effect_date = @currDate AND isapplied = 0)
IF @checkForTasks > 0
-- If current date = task date then perform this task
BEGIN
SET @created_by_id = (SELECT TOP 1 createdby FROM [dbo].[sd_gst_effective_table] WHERE effect_date = @currDate AND isapplied = 0)
SET @gst_ID = (SELECT gst_id FROM [dbo].[sd_gst_effective_table] WHERE effect_date = @currDate AND isapplied = 0)
-- STEP 1 :: InActivate the existing GST according to createdbyID
UPDATE sd_gst_rate
SET isactive = 0,
inactivedate = Getdate()
WHERE isactive = 1
AND createdby = @created_by_id
-- STEP 2 :: Activate the New GST according to implementation date and gstID
UPDATE sd_gst_rate
SET isactive = 1,
activedate = Getdate()
WHERE id = @gst_ID
-- STEP 3 :: Inactivate the applied GST from sd_gst_effective_table
UPDATE [dbo].[sd_gst_effective_table] SET isApplied = 1 WHERE gst_id = @gst_ID
END
END
DECLARE @Text AS VARCHAR(100)
DECLARE @Cmd AS VARCHAR(100)
DECLARE @value nvarchar(1000);
SET @value = (SELECT CONVERT(TIME,GETDATE()) AS HourMinuteSeconds);
SET @Text = 'File Writed ' + @value
SET @Cmd ='echo ' + @Text + ' > E:\AppTextFile.txt'
EXECUTE Master.dbo.xp_CmdShell @Cmd
This is resided in videos folder of windows , i have created a task schedular in windows 8.1 to run daily at every 10 seconds , but it is not working ... Please tell me how to deal with it.
Please note : This sql query is running perfectly in sql server. Query have no errors. Please check whats wrong with my time schedular. I just want my schedular to run every 10 seconds regardless of date.Hi Emad,
Is your script in a ".sql" file? May I know how you configure the schedule task action?
Since you didn't mention how you configure the schedule task, can you confirm you have followed the below step correctly?
Save your script in a ".sql" file.
Create a ".bat" file and call the sql file above inside with
sqlcmd.exe, you can reference
here.
Configure a schedule task to run the ".bat" file in a certain interval.
Have you tried to run the script in you bat file in a standalone commandline window? Please post the script in your bat file, It can help to diagnose the issue.
If you have any question, feel free to let me know.
Eric Zhang
TechNet Community Support -
How to run SQL entered in a table.
Hi,
I have a table and in that table I have rows with sql commands, I want to select a single row I mean a single sql statement to run. How to achieve this from forms 10g ? I will retrieve that row from table, get the sql in a variable and how to run that sql in a variable. Please let me know. Thank you. Also let me know whether I need to have a semicolon in the row at the end of the sql command in that row of sql command.
I want to use that sql in create_group_from_query command to populate list of values.
Any Gurus out there ?Hi Jowal,
I was back after many days, I tried your sql code, I populated it in variable with same size characters and passed it to the list item, but it is not running ! Can you please let me know what is the problem ? When I hard code sql then only the query is running and populating the list otherwise not. There are no errors displayed. The list item is just not getting populated. Forms 10g patchset 10.1.2.0.2 oracle database 11g on windows 7
Please help. -
How run Procedure in SQL Developer?
I need run procedure in SQL Developer with parameter : 2009
create or replace PROCEDURE "update_table" (ff_year in varchar2) AS
CURSOR c_update IS
select DISTINCT P.mafew name, u.frew nameone, t.greddf, .........
I click green button RUN and have new window Run PL/SQL. Where in this script I need to print 2009?
DECLARE
FF_YEAR VARCHAR2(200);
BEGIN
FF_YEAR := NULL;
update_table(
FF_YEAR => FF_YEAR
END;Hi,
user10886774 wrote:
Thanks all!
I can run the procedure like 1 or 2 example? Is it right?
1 like Run Script
EXEC "UPDATE_TABLE" ('2009');
2 click RUN on UPDATE_TABLE procedure
DECLARE
FF_YEAR VARCHAR2(200);
BEGIN
FF_YEAR := '2009';
UPDATE_TABLE(
FF_YEAR => FF_YEAR
END;
What is the name of the procedure?
Is it update_tabe (all small letters)? If so, you must reference it as "update_table" (all small letters, inside double-quotes).
Is it UPDATE_TABLE (all capital letters)? If so, you have the choice of referencing it as "UPDATE_TABLE" (all capital letters, inside double-quotes) or as update_table, or Update_Table, or UPDATE_TABLE, or uPdAtE_taBle, or ... (any kind of letters, without quotes).
How about commit after?How about it?
What is the question?
If you want to commit, say COMMIT or click on the COMMIT icon.
Maybe you are looking for
-
SSRS 2008 - Expression for totals in a Matrix
Hi, I have a simple Matrix with the following groups: Row Group: Program Column Group: Employee I need to add a new total column on the right side of the matrix using a simple calculation but I haven't been able to find how to do that other than doin
-
I put in a lettered passcode recently and now it won't work anymore and iTunes could not let me type in the password and only solution is to restore it. I really do NOT want to restore it at all because I highly value the info, saved pics and li
-
Is there a way to output multiple waves to soundboard
Working on two projects that could benefit from multiple sounds being played at once. 1st is a C64 SID emulator. The SID has 3 voices Each with there own ADSR and waveform. I can generate a single waveform with attack and decay and get decent sounds
-
Can't configure deployed WebCenter app using Enterprise Manager after WLST
Using fusion middleware version 11.1.1.4 with WLS and WebCenter of same versions. I deployed an ADF application using WLST and the application mostly runs, but I need to configure some portal connections from the Enterprise Manager. I am able to conf
-
Is there a system status web page for iCloud and email?
It's days like this that I scratch my head wondering how to find Apple technical assistance. Does it exist? At least we have a forum to see that everyone else is having problems too.