How to determine IP address in stored procedure ?
Hello :)
I want to determine caller's IP address from a stored procedure without having to receive it as parameter.
Thanks in advance
Nishu
you can use sys.dm_exec_connections
SELECT client_net_address, *
FROM sys.dm_exec_connections
WHERE session_id = @@SPID
http://msdn.microsoft.com/en-us/library/ms181509.aspx
Thanks
Saravana Kumar C
Similar Messages
-
How to use order by in stored procedure base block?
How to use order by in stored procedure base block? I need to change order by dynamically
Use SET_BLOCK_PROPERTY('BLOCK_NAME',ORDER_BY,'COLUMN_NAME1, COLUMN_NAME2');
-
How to write a PL/SQL stored procedure in Oracle to call Webservice
Can any one pelase send me a code on how to write a PL/SQL stored procedure in Oracle database to call the Webservice ?
Thanks,
RajeshWere you able to solve this problem
-
How to call a sql server stored procedure from oracle
Hi all,
Please anybody tell me how to call a sql server stored procedure from oracle.
I've made an hsodbc connection and i can do insert, update, fetch data in sql server from oracle. But calling SP gives error. when I tried an SP at oracle that has line like
"dbo"."CreateReceipt"@hsa
where CreateReceipt is the SP of sql server and hsa is the DSN, it gives the error that "dbo"."CreateReceipt" should be declared.
my database version is 10g
Please help me how can i call it... I need to pass some parameters too to the SP
thanking youhi,
thank you for the response.
when i call the sp using DBMS_HS_PASSTHROUGH, without parameters it works successfully, but with parameters it gives the following error
ORA-28500: connection from ORACLE to a non-Oracle system returned this message:
[Generic Connectivity Using ODBC][Microsoft][ODBC SQL Server Driver]Invalid parameter number[Microsoft][ODBC SQL Server Driver]Invalid Descriptor Index (SQL State: S1093; SQL Code: 0)
my code is,
declare
c INTEGER;
nr INTEGER;
begin
c := DBMS_HS_PASSTHROUGH.OPEN_CURSOR@hsa;
DBMS_HS_PASSTHROUGH.PARSE@hsa(c, 'Create_Receipt(?,?)');
DBMS_HS_PASSTHROUGH.BIND_VARIABLE@hsa(c,1,'abc');
DBMS_HS_PASSTHROUGH.BIND_VARIABLE@hsa(c,2,'xyz');
nr:=DBMS_HS_PASSTHROUGH.EXECUTE_NON_QUERY@hsa(c);
DBMS_HS_PASSTHROUGH.CLOSE_CURSOR@hsa(c);
end;
Create_Receipt is the sp which requires two parameters.
please give me a solution
thanking you
sreejith -
How to execute .sql file in Stored Procedure?
Hi,
I have an urgent requirement, where i have to execute .sql file form Stored Procedure.
This .sql file will have set of update statement. I need to pass value to this update statement.
Kindly please help me.
Regards,
IrfanThis is required as part of Data Migration where i have to do 100 of table's update. Each time update table will defer, so its better to have in separate script file (.sql). Can u paste some sample/syntax to exceute .sql file from stored procedure. I am new to this PL/SQL.
How have you determined that it's "better" to have seperate scripts? I assume you mean the table name will "differ" (and not "defer" - I assume that's just because English isn't your first language? no problem - I think I understand what you're asking).
So what I think you're asking is that you have dynamic table names but each table needs to be updated in the same way?
Question: Why do you have tables with different names that all need the same process doing to them?
Assuming it's a valid requirement (and 99% of the time doing dynamic coding implies it's not).... you could use dynamic code, rather than 'scripts'...
e.g.
create procedure update_table(tbl_name varchar2) is
begin
execute immediate 'update '||tbl_name||' set lastupdate = null';
end;
As you haven't bothered to provide a database version, any example code/data or explanation of what you're actually doing, you're not going to get any detailed answer. Please do take the time to read the FAQ and post appropriate details so people can help you. -
How to use materialized view in stored procedure
in my stored procedure I use couple of queries (see the script below). I want to create materialized views to replace these queries. Is it possible to achieve and how to achieve it in my case? thanks in advance
set serveroutput on
DECLARE
v_cur_tid NUMBER(5):=0;
v_cur_cs_attendance NUMBER(5):=0;
v_cur_c_tot_enrolments NUMBER(5):=0;
v_most_enrolments NUMBER(5):=0;
v_least_enrolments NUMBER(5):=0;
v_most_pop_cid NUMBER(5):=0;
v_least_pop_cid NUMBER(5):=0;
CURSOR class_cursor IS
select
id,
name,
max_attendees
from
class
where
id in (select distinct(event_id) from trainer_schedule where event_type='c' and is_active='y')
order by id;
BEGIN
DBMS_OUTPUT.PUT_LINE('==================================================================================================================================');
--print the report header
DBMS_OUTPUT.PUT_LINE('Summary Report No.3: Training Class Active Schedules Summary Report');
FOR r_class IN class_cursor LOOP
--print the header or subsection
select sum(enrolments) into v_cur_c_tot_enrolments from class_schedule where class_id = r_class.id;
IF v_most_enrolments < v_cur_c_tot_enrolments OR v_most_enrolments = 0
THEN v_most_enrolments := v_cur_c_tot_enrolments; v_most_pop_cid := r_class.id;
END IF;
IF v_least_enrolments > v_cur_c_tot_enrolments OR v_least_enrolments = 0
THEN v_least_enrolments := v_cur_c_tot_enrolments; v_least_pop_cid := r_class.id;
END IF;
DBMS_OUTPUT.PUT_LINE('******************************************************************************************');
DBMS_OUTPUT.PUT_LINE('CLASS_ID: ' || r_class.id ||' '|| 'CLASS_NAME: ' || r_class.name ||' '||'CAPACITY: ' || r_class.max_attendees ||' '||'TOTAL_ENROLMENTS: ' || v_cur_c_tot_enrolments);
DBMS_OUTPUT.PUT_LINE(rpad('____________', 12) || lpad('____________', 12) || lpad('____________________', 20) || lpad('____________________', 20) || lpad('____________',12) || lpad('____________',12));
DBMS_OUTPUT.PUT_LINE(rpad('SCHEDULE_ID', 12) || lpad('TRAINER_ID',12) || lpad('START_TIME', 20) || lpad('END_TIME',20) || lpad('ENROLMENTS',12) || lpad('ATTENDANCE',12));
DBMS_OUTPUT.PUT_LINE(rpad('____________', 12) || lpad('____________',12) || lpad('____________________', 20) || lpad('____________________', 20) || lpad('____________',12) || lpad('____________',12));
FOR r_cs IN (select id,to_char(start_time,'DD-MM-YYYY HH24:Mi') as start_time, to_char(end_time,'DD-MM-YYYY HH24:Mi') as end_time, enrolments from class_schedule where class_id = r_class.id order by id)
LOOP
select trainer_id into v_cur_tid from trainer_schedule where event_type='c' and event_id = r_cs.id;
select count(training_session.id) into v_cur_cs_attendance
from training_session, class_schedule
where training_session.attended = 'y' and
training_session.type='c'and
to_char(training_session.start_time,'DD-MM-YYYY HH24:Mi') = to_char(class_schedule.start_time,'DD-MM-YYYY HH24:Mi') and
class_schedule.id = r_cs.id;
DBMS_OUTPUT.PUT_LINE(rpad(r_cs.id, 12) || lpad(v_cur_tid,12) || lpad(r_cs.start_time, 20) || lpad(r_cs.end_time,20) || lpad(r_cs.enrolments,12) || lpad(v_cur_cs_attendance,12));
END LOOP;
END LOOP;
DBMS_OUTPUT.PUT_LINE('******************************************************************************************');
DBMS_OUTPUT.PUT_LINE('******************************************************************************************');
DBMS_OUTPUT.PUT_LINE('MOST_POPULAR_CLASS: '||v_most_pop_cid||' TOTAL_ENROLMENTS_TO_DATE: '||v_most_enrolments);
DBMS_OUTPUT.PUT_LINE('LEAST_POPULAR_CLASS: '||v_least_pop_cid||' TOTAL_ENROLMENTS_TO_DATE: '||v_least_enrolments);
DBMS_OUTPUT.PUT_LINE('==================================================================================================================================');
END;
/Hi,
you could use Dynamic SQL /Execute immediate to run DDL from a stored procedure.
http://download-uk.oracle.com/docs/cd/B10501_01/appdev.920/a96624/11_dynam.htm
Could you please tell why do you want to create a materialized view in stored procedure ?
How frequently you will runt this procedure . It would is better to create a MV once and use it.
thanks -
How to kill a session in stored procedure or trigger.
Can anyone let me know, how to kill a particular session in stored procedure or trigger.
Regards
KVSSalso you cannot attempt to kill ur own current session.
But on what circumstances you want to kill the session.
When anyone trys to access a table and lets suppose the trigger onthat table activates
and you want to kill that very session which activated the trigger ???
i dont think its possible. To kill a session definitely you should be in a different session and
then only you can achieve that.
pls check it out
prakash
[email protected] -
How to use @jws:sql call Stored Procedure from Workshop
Is there anyone know how to use @jws tag call Sybase stored procedure within
Workshop,
Thanks,Anurag,
Do you know is there any plan to add this feature in future release? and
when?
Thanks,
David
"Anurag Pareek" <[email protected]> wrote in message
news:[email protected]..
David,
In the current release, we do not support calling stored procedures from a
database control. You will have to write JDBC code in the JWS file to call
stored procedures.
Regards,
Anurag
Workshop Support
"David Yuan" <[email protected]> wrote in message
news:[email protected]..
Anurag,
I know how to use DB connection pool and create a db control with it. In
fact, we have created a Web Service with the db control using plain SQL
in
@jws:sql. However, my question here is how to use @jws tag in Weblogic
Workshop to create a Web Services based on Sybase stored procedure orany
Stored Proc not plain SQL.
Thanks,
David
"Anurag Pareek" <[email protected]> wrote in message
news:[email protected]..
David,
You can use a database control to obtain a connection from any JDBC
Connection Pool configured in the config.xml file. The JDBC Connectionpool
could be connecting to any database, the database control is
independent
of
that.
Regards,
Anurag
Workshop Support
"David Yuan" <[email protected]> wrote in message
news:[email protected]..
Is there anyone know how to use @jws tag call Sybase stored
procedure
within
Workshop,
Thanks, -
How to create csv file in stored procedure
I want the output of my stored procedure in a csv file. How can I do that?
1) define File Paths
2) Write the output comma seperated to the file.
Simple :)
Hope you are comfortable with File operations.
URL for your reference
PL/SQL output to .CSV file
Regards,
Bhushan -
How to get sequence nextvalue in stored procedure?
Hi, guys,
I am trying to obtain the nextvalue of a sequence in a stored procedure, ultimately this value shall be returned to caller, but how do I assign or get the sequence value inside a stored procedure?
Thanks
jimfoo NUMBER;
SELECT mysequence.nextval INTO foo FROM DUAL; -
How to determine the address of the server whence the application through W
The application is loaded from the server taking place in Intranet networks. How to determine from this application the address of the server with which it it is loaded?
KSVUse could use the javax.jnlp BasicService.getCodeBase(). See http://java.sun.com/j2se/1.5.0/docs/guide/javaws/developersguide/examples.html and http://java.sun.com/j2se/1.5.0/docs/guide/javaws/jnlp/javax/jnlp/BasicService.html
-
How to call PL-SQL script/stored procedure from Java?
Assume I want to call a PL-SQL stored procedure from external Java program.
How can I do this?
Is there a simple "Hello world" example for this?
PeterThis forum is for Oracle only not for java
Ug -
How to call PL-SQL script/stored procedure from BPEL?
Assume I want to call a PL-SQL stored procedure from BPEL.
How can I do this?
Is there a simple "Hello world" example for this?
PeterThe database adapter supports calling stored procedures. There is an example called "File2StoredProcedure" that you can use as a reference to get started.
-
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 Do I Call PL/SQL Stored Procedure That Returns String Array??
I Have Problem Calling An Oracle(8i) Stored Procedure That Returns Array Type (Multi Rows)
(As Good As String Array Type..)
In This Fourm, I Can't Find Out Example Source.
(Question is Exist.. But No Answer..)
I Want An Example,, Because I'm A Beginner...
(I Wonder...)
If It Is Impossible, Please Told Me.. "Impossible"
Then, I'll Give Up to Resolve This Way.....
Please Help Me !!!
Thanks in advance,// Try the following, I appologize that I have not compiled and run this ... but it is headed in the right direction
import java.sql.*;
class RunStoredProc
public static void main(String args[])
throws SQLException
try
Class.forName("oracle.jdbc.driver.OracleDriver");
catch(Exception ex)
ex.printStackTrace();
java.util.Properties props = new java.util.Properties();
props.put("user", "********"); // you need to replace stars with db userid
props.put("password", "********"); // you need to replace stars with userid db password
// below replace machine.domain.com and DBNAME, and port address if different than 1521
Connection conn =
DriverManager.getConnection("jdbc:oracle:thin:@machine.domain.com:1521:DBNAME", props);
// replace "Your Stored Procedure" with your stored procedure
CallableStatement stmt = conn.prepareCall("Your Stored Procedure");
ResultSet rset = stmt.execute();
while(rset.next())
System.out.println(rset.getString(1));
Maybe you are looking for
-
20" acrylic Display not working with 15" MBP
I have a 20" acrylic Cinema display (with the Apple ADC-DVI adapter) that works fine with a PC and with my 15" G4 PowerBook. When I try to use my 15" MacBook Pro (the 512meg VRAM one) the internal screen flashes but the Cinema display never shows any
-
Hi Experts I have facing some confusion when i am doing mapping for my scenario FILE to IDOC. The IDOC Structure is as follows HeaderRecord 0-1 DataRecord1 0-unbounded (Subnode)DataRecord2 0-unbounded (Subnode)DataRecord4 0-unbounded
-
Soft proofing bug on my computer
I find that if I soft proof an image and create the soft proof copy that if I change paper types the display will change but the info display still shows the original paper that was selected. Not a big deal, because I can look at the panel and see wh
-
Does MAP tool capture User Summary (count of users, their details) for SQL Server 2008? At my end, its working for SQL Server 2012 but not showing User Summary for SQL Server 2008.. Does the User Summary only works for SQL Server 2008 Enterprise ed
-
Sample rate (X_Value) is wrong
On one particular PC i recorded: X_Value 0 1.000122 2.000243 3.000365 4.000486 5.000608 6.00073 7.000851 8.000973 on every other PC i recorded: X_Value 0 1 2 3 4 5 6 7 8 Just have a simple timed while(1000ms) loop around a "Write To Measurement File"