Query, PL/SQL and V$ SESSION.sql_address
I am running a procedure on a database of GR 11, 2 through a PL/SQL script in Linux-side SQLPlus. The procedure makes an insertion, and then ends.For the first few minutes, a join between V$ SQL_SESSION.sql_address and V$ SQL_TEXT.address for this SID returns SQL procedure for its insertion.
However, it then suddenly returns "no rows found." A glance in V$ SESSION shows that V$ SESSION record of the SID has sql_address '00 ". The SQL insert statement appears in V$ SQL, and the table to which the procedure is inserting data still holds a lock on this subject.
Is this a normal behavior?
-Don
Yes.
All SQL can be reused, the purpose of the shared pool is to share sql analyzed between sessions. That's why the SQL remains in the shared pool and is visible through v$ sql.
An address '00' sql means that no SQL statement is running.
Locks will be released by a later commit or rollback. Note: you should engage a logical work unit, so not all records.
----------
Sybrand Bakker
Senior Oracle DBA
Tags: Database
Similar Questions
-
More than 1 SQL query with checkbox and error invalid number report
Hi all
I have two SQL query reports that each has an apex_item.checkbox and two processes for each report. A report/process works very well. It gives me an error of invalid number.
In addition, another query SQL (editable report) gives me the following error when using the Multi line process, delete.
ORA-06502: PL/SQL: digital or value error: character number conversion
error ORA-06502: PL/SQL: digital or value error: character number conversion
errorOk When I got a report from SQL query (with box and a process) and the query SQL (editable report) everything worked. It stopped working when I added another SQL query report (with box and a process).
A SQL query has the following in my query: apex_item.checkbox(3,email_id,'UNCHECKED') ""
The other SQL query has the following: apex_item.checkbox(2,b.file_id,'UNCHECKED') ""
Any help will be greatly appreciated,
Sylvia
Hi Reema,
I've recreated the region and now it works!
Thank you for this, looking at
Sylvia
-
SQL query with terms and calculations?
Hello
How do I create a query with terms and calculations?
For example, I have this table
Start | End | At work | Mandatory
------------------------------------------------------------------------------------
1ST JANUARY 13 | JANUARY 11, 13. Office | 1
JANUARY 14, 13. 25 JANUARY 13 | Ministry of the Interior. 0
04-MRZ-13 | 15-MRZ-13 | Office | 0
FEBRUARY 11, 13. FEBRUARY 22, 13. Office | 1
Now, if the workplace of the column = office and required column = 0
the new 'price' column should calculate: (end-start) * $25.00
and if workplace = Office and required column = 1
the 'price' column must calculate: (end-start) * $20.60
any other $0.00
I tried with the case statement, but I didn't know how
to calculate my values and display in the virtual column 'price '.
Something like
case
When Working_Place = 'Office' and mandatory = 1
then...
else ' 0.00'. "
end PRICE
?????
Or is that not possible?
Published by: DB2000 on 12.03.2013 05:09Use CASE:
select start_dt, end_dt, working_place, mandatory, case when working_place = 'Office' and mandatory = 0 then (end_dt - start_dt) * 25 when working_place = 'Office' and mandatory = 1 then (end_dt - start_dt) * 20.60 else 0 end price from tbl / START_DT END_DT WORKING_PLA MANDATORY PRICE --------- --------- ----------- ---------- ---------- 01-JAN-13 11-JAN-13 Office 1 206 14-JAN-13 25-JAN-13 Home Office 0 0 04-MAR-13 15-MAR-13 Office 0 275 11-FEB-13 22-FEB-13 Office 1 226.6 SQL>
SY.
-
Different output for the same query in SQL Server and Oracle
I have two tables table1 and table2
-table1 has two columns c1 int and varchar c2. There are no constraints added in it. It contains data as shown below
C1 c2
-------------------
d 6
5 d
102 g
6%
f 103
5.
501 j
1 g
601 n
2 m
-table2 has only a single column c1 int. There is no added in constraints. It contains data as shown below
C1
----
6
1
4
3
2
now when I run below, given the query in sql server and oracle it gives me different results
Select *.
FROM table1
table2 on table2.c1 = table1.c1 inner join (SELECT ROW_NUMBER() (any ORDER by ASC c1) AS c1 from table2)
output of SQL server
------------------------
C1 c2 c1
--------------------------------
1 g 1
2 m 2
3 h 3
4 g 4
5 d 5
release of Oracle
----------------------
C1 C2 C1
---------------------------------
5 d 5
4 g 4
3 h 3
1 g 1
2 m 2
If you notice the first column in the two outputs. It is sorted in sql server and no oracle.
Why he behaves differently in oracle? Is there a way I can fix this problem in oracle?
Thank you
JigsIt is NOT a behavior "differently" in Oracle; you did not specify just an order that you expect of your results, so you'll get output in what order the fantasies of the database showing (ie. no guaranteed order). It is an artifact of the way the database chooses to collect the data and databases (or same sets of data within the same database) can and will most likely behave differently.
Same SQL Server will not be guaranteed to always get your data in an orderly manner if you exclude the order by clause, even if you think that there always display the data in an orderly manner.
Your solution is to add an order by clause, in the TWO databases, to force the order of the data output.
-
continuously run a query in sql prompt
Hello
We want to run a query that shows the current sessions connected, the application must run continuously from the sql prompt.
Select INST_ID select NŒUD, count (*) Current_sessions of GV$ SESSION where username IN ('XxX', 'XXX') group by order INST_ID select 1;
Can it be implemented with a kind of stored procedure that runs in a loop with a time interval?
Any help would be much appreciated.
Thanks in advance!user-1221 wrote:
I wonder if do you the same thing with your PHB :)in any case, I created a small batch file and scheduled it with the Windows Task Scheduler, hope this will give him satisfaction.
Thank you for you answer.
But that does not make him have to pick up the results? And who does not lack the "requirement" for "continuous"?
Maybe something like this will satisfy the e-Director of Information and Office Automation
--- cmd file :query sqlplus scott/tiger@orcl @run_query goto query --- sqlfile: run_query.sql set echo off select inst_id NODE, count(*) Current_sessions from GV$SESSION where username IN ('XxX','XXX') group by inst_id order by 1; select to_char(sysdate,'dd-Mon-yyyy hh24:mi:ss') CurrentTime from dual; prompt Are we there yet? exit
Edited by: EdStevens may 25, 2013 08:30
Edited by: EdStevens may 25, 2013 08:32
Edited by: EdStevens may 25, 2013 13:35
-
Hello Experts;
I used some tools like Microstrategy bi, however it is still not comparable to a coding in SQL, PL/SQL, which gives a lot of flexibility, transparency, etc. So, how is it I always get customers pushing to have all of the BI process done on BI tools. Why SQL and PL/SQL, not at the forefront instead. I know that the graphical side of things put it at a disadvantage, but beside that I'm still why a little distraught.
SQL and PLSQL can scare companies, many see a black magic (which, in some respects, can be), and it is not something that many customers feel able to learn or even tend to. On the face of things, this may seem complicated and used wrongly, can cause MAJOR problems with buinesses (poor performance, use excessive resources that affect other sessions). Many have invested time in getting to know point and click graphical tools that can get results without feeling lost and confused by SQL, they prefer.
However, as you rightly remember, nothing can replace SQL or PL/SQL.
I suppose that the element of fear is a bit like why a lot of people using MS Paint to edit an image, many feel uncomfortable with it, he can do the basics, but not much, and they'll settle for that, but you could do much more with Photoshop - it's simply too scary to learn properly for most of the people so that they avoid it - they stick to what is simple and familiar.
-
Master-detail functionality between the regions of PL/SQL and IR possible?
4.2.1
THM 2
Hi all
We have two regions in a page. The upper region is a region of PL/SQL that lists the 5 best wages by Dept. This was not done using traditional reports because management wanted a "dashboard" as the look and feel that is already existing and what is happening in that it is a pl/sql block that has the sliders and the necessary HTML, CSS in there.
Below that is an IR when the user clicks on the dept of region of PL/SQL, it will refresh the IR below to display all employees in this Department
Top of the page shows region of PL/SQL
EMP name Dept wage
Emp1 10 10000
EMP2 10 950
Emp3 20 800
The Dept field is a hyperlink.
When we click on Dept on this region of PL/SQL
The lower IR should be updated (without submit page)
Output
Emp1 10 10000
EMP2 10 950
It is a kind of master-detail relationship between PL/SQL and Report (Detail) (Master) area Interactive
We can hyperlink in the SQL in pl/sql area, but you wonder how trap line and pass the dept id to the IR and get this region to refresh account?
All suggestions from the experts?
Thank you
Ryan
It is a way to pass the info in connection
Perform the dynamic Action of the link column report
The dynamic action can submit the session state value, and then refresh the IR.
On either by the way, you must create dynamic PL/SQL region to solve this problem, see this
APEX reports: layout custom with a column named (model line)
-
EUL5. SQL and other administrative issues
I am responsible for creating reports for an application based on Oracle.
As part of the purchase, the supplier of the application supplied discoverer. The seller installed discoverer. The provider support is not very well on their own request, so I don't even try to get help from their share of issues of discoverer.
Some of the users of the application build reports using discoverer; I, personally, hate it.
I am, by nature of my post, considered the Discoverer administrator, however. I don't know anything about the software, but have recently found how I can get the end-user reports shared for me (for purposes of, then, sharing to others) through SQL (I know, I know - is not supposed to do it this way - but to get my end users to track the requests on the part is like pulling teeth).
In read so, however, it became clear that I had no EUL functions installed for END user license holder.
I tried to run eul5.sql, and I get "insufficient permissions", if!
What owner eul permission would be missing, and how I give you that? (I have access level of the Oracle database sys taking the NLY).
Thank you!
Start with the following privs to the eul_owner:
CREATE SESSION
CREATE TABLE
CREATE VIEW
CREATE SEQUENCES
CREATE PROCEDURE
CREATE SESSION
CREATING USER
GRANT A PRIVILEGE
ALTER USER
-
Help with SQL query for SQL experts!
Hi all
For the very expert on SQL.
------------------
create table t1 (STEP number);
Insert into t1 select rownum from dba_tables where rownum < 11;
commit;
create table t2 (the STEP number, name varchar2 (4), varchar2 (1)) of the State;
insert into t2 values (1, 'TOTO', ' A');
insert into t2 values (3, 'TOTO', 'C');
insert into t2 values (4, 'TOTO', ');
insert into t2 values (1, 'FIFI', ' A');
insert into t2 values (6, 'FIFI', 'B');
commit;
----------------
My goal is to list the STATE in the NAME of all the STEPS, even if measures do not exist for a NAME.
In other words, my query should return a result like this: (query on t1 and t2, of course)
STEP 1 2 3 4 5 6
TOTO A C D NO NO NO
FIFI HAS NO NO NO NO D
Thank you in advance.
with the data as)
Select
T1. Step step
name
State
Of
T1, t2
where
T1. Step = T2. Step (+)
)Select
*
from the data
Pivot (max (state))
for step (1,2,3,4,5,6,7,8,9,10)
)
where the name is not nullNAME 1 2 3 4 5 6 7 8 9 10 TOTO A - C D - - - - - - FIFI A - - - - B - - - - If the column name must be the stage instead of the name
with the data as)
Select
Step 1 T1. Step
name as step
State
Of
T1, t2
where
T1. Step = T2. Step (+)
)Select
*
from the data
Pivot (max (state))
for step 1 in (1,2,3,4,5,6,7,8,9,10)
)
where the step is not null -
the variable name of database query to SQL Server using the Oracle database link
Hi all
I have an ApEx 4.1 application running on x 64 (11.2.0.1) 11g on Windows Server 2008 x 64, and I have a few points of data integration with SQL (2005 and 2008) server that I need to create. I have configured the database with dg4odbc link and it works perfectly... I can run queries on the SQL Server database without any problem using the database link.
However, there is a scenario where the SQL Server database name is dynamic, and I need to generate on the fly in a PL/SQL block and then use it in a query dynamic SQL (all this in the ApEx). It of wherever I meet problems... when I asked the default database that is based on the ODBC connection and I don't have to specify the name of the database, no problem. But when I need access to one of the several other databases by default, I received the error "invalid table.
It works well:* (note that 'fv' is the name of my database link)
v_query1: = "select 'Release Date' from dbo." Schedules@FV where dbo. Annexes. "" SchedID "=: calendar";
EXECUTE IMMEDIATE v_query1 in rel_date using the grid.
I then take this rel_date variable, convert a varchar2 (rel_date_char), then use it as the name of the database in the following query...
_ It returns an error(error ORA-00903: invalid table name)
v_query2: = "select"PARTNO": rel_date_char.dbo.ProdDetails@fv where 'SchedID' =: calendar and"UnitID"=: unit"
and 'MasterKey' =: master and "ParentKey" =: parent';
EXECUTE IMMEDIATE v_query2 in part_number using planning, master, parent unit;
I also tried using all of the following conditions without result:
"select"PARTNO"of" | : rel_date_char | '.dbo. ProdDetails@fv where 'SchedID '...
"select"PARTNO"of" | rel_date_char | '.dbo. ProdDetails@fv where 'SchedID '...
"select"PARTNO"of" | @rel_date_char | '.dbo. ProdDetails@fv where 'SchedID '...
"select"PARTNO"in @rel_date_char.dbo.ProdDetails @fv where 'SchedID'..."
Is it possible to do it in PL/SQL?
Thanks for any help!
-Ian C.
Published by: 946532 on July 15, 2012 19:45Just did a test using passthrough:
SQL > set serveroutput on
SQL > declare
2 val varchar2 (100);
3 c whole;
4 whole nr;
5. start
c: 6 = dbms_hs_passthrough.open_cursor@FREETDS_DG4ODBC_EMGTW_11_2_0_3;
7 dbms_hs_passthrough.parse@FREETDS_DG4ODBC_EMGTW_11_2_0_3 (c, "select count (*) from EMP");
8 LOOP
9 nr: = DBMS_Hs_Passthrough.fetch_row@FREETDS_DG4ODBC_EMGTW_11_2_0_3 (c);
10 output when nr = 0;
11 dbms_hs_passthrough.get_value@FREETDS_DG4ODBC_EMGTW_11_2_0_3 (c, 1, val);
12 dbms_output.put_line (val);
13 end of loop;
14 dbms_hs_passthrough.close_cursor@FREETDS_DG4ODBC_EMGTW_11_2_0_3 (c);
15 end;
16.
24576PL/SQL procedure successfully completed.
SQL > declare
2 val varchar2 (100);
3 c whole;
4 whole nr;
5. start
c: 6 = dbms_hs_passthrough.open_cursor@FREETDS_DG4ODBC_EMGTW_11_2_0_3;
7 dbms_hs_passthrough.parse@FREETDS_DG4ODBC_EMGTW_11_2_0_3 (c, ' select count (*) from dbo.) EMP');
8 LOOP
9 nr: = DBMS_Hs_Passthrough.fetch_row@FREETDS_DG4ODBC_EMGTW_11_2_0_3 (c);
10 output when nr = 0;
11 dbms_hs_passthrough.get_value@FREETDS_DG4ODBC_EMGTW_11_2_0_3 (c, 1, val);
12 dbms_output.put_line (val);
13 end of loop;
14 dbms_hs_passthrough.close_cursor@FREETDS_DG4ODBC_EMGTW_11_2_0_3 (c);
15 end;
16.
24576PL/SQL procedure successfully completed.
So all 3 ways work for me.
Published by: kgronau on July 23, 2012 10:08
Now, using the variables to make the selection:
SQL > declare
2 val varchar2 (100);
3 c whole;
4 whole nr;
5 tabname varchar2 (20): = 'EMP ';
6 ownr varchar2 (20): = "dbo."
7 dbname varchar2 (20): = "door";
Start 8
c: 9 = dbms_hs_passthrough.open_cursor@FREETDS_DG4ODBC_EMGTW_11_2_0_3;
10 dbms_hs_passthrough.parse@FREETDS_DG4ODBC_EMGTW_11_2_0_3 (c, ' SELECT count (*) FROM ': dbname: '.) ' || ownr | '.'|| tabname | ") ;
11 LOOP
12 nr: = DBMS_Hs_Passthrough.fetch_row@FREETDS_DG4ODBC_EMGTW_11_2_0_3 (c);
13 when the exit nr = 0;
14 dbms_hs_passthrough.get_value@FREETDS_DG4ODBC_EMGTW_11_2_0_3 (c, 1, val);
15 dbms_output.put_line (val);
16 end loop;
17 dbms_hs_passthrough.close_cursor@FREETDS_DG4ODBC_EMGTW_11_2_0_3 (c);
18 end;
19.
24576PL/SQL procedure successfully completed.
=> instead of executing the statement using the "execute Immediate" we use the PASTHROUGH package to pass the statement to SQL Server.
Published by: kgronau on July 23, 2012 10:10
-
(Is setting SQL against the session poosible)
My client of the company noted that there are jobs that are running longer than expected (5 days).
They have not made me any information.they want to run
Setting the SQL against the session runs this task.
can you run sql tunning against the session running advisor?
If so, how
Please suggest me your precious advice so that I approach this work correctly.
DB = 11g
OS = Solaris 10880674 wrote:
can you run sql tunning against the session running advisor?You cannot run SQL tuning advisor against a session, but if you have the privilege of s/n you can start a trace against an existing session and analyze the results of tkprof
-
How export (unload) result of the query without running query on sql developer
Hello
I want to know how export (unload) result of the query without running query on sql developer.
I know this way.
1. execution of query
2. click on "Download" on the results tab
http://i.stack.imgur.com/CQ4Qb.jpg
Is he available unload a query result before the race?No, but you can do this ask the developer SQL change however, for other users can vote and add weight to the possible future implementation.
Kind regards
K. -
Hello
I am trying to run a query on a request that I stored in a .sql file. I tried the following without success. It's a mad race or I just got the wrong syntax?
With some search terms such as "sql" and "file" I'm not having much luck Googling. Appreciate any advice.
Thank you
Jon
Does my sql query but I want to ask this in turn@G:\JFlett\PLSQLScripts\NewQPort_KTandMG.sql;
with t as ( @G:\JFlett\PLSQLScripts\NewQPort_KTandMG.sql; ) select deal_id from t
select deal_id from ( @G:\JFlett\PLSQLScripts\NewQPort_KTandMG.sql; )
It wouldn't CREATE TRIGGER but CREATE a TASK.
http://download.Oracle.com/docs/CD/B28359_01/server.111/b28310/schedover.htm#i1106753But you don't seem to have it.
Someone else could possibly create it for your schema/user if they had the privilege to CREATE ANY JOB. -
interactive writing sql and loop
I need to write sql and script, which creates a user
password must be entered by the interactive user. I wrote a few something like that but does not work.
Algorithm:
========
PSWD VARCHAR2 VARIABLE
PSWD2 VARCHAR2 VARIABLE
BEGIN
REAL WHILE LOOP
ACCEPT GUEST pswd ' password: ' HIDE
ACCEPT pswd2 PROMPT you enter password: ' HIDE
If pswd! = pswd2 then
Guest ' the password is not.
ON THE OTHER
GUEST "PASSWORD CORRESPONDENT"
END IF;
EXIT;
END LOOP;
END;
=========================
I know that several sql does not have control structures and pl/sql doest involved statements?
Thanks in advance for your answer.
PhaniHello
The only conditional thing in SQL * more is the ability to define variables substitution conditionally the results of a query. You can use it to make some gross loops.
For example, you might have a script called ask_pswd.sql:ACCEPT pswd PROMPT 'Password: ' HIDE ACCEPT pswd2 PROMPT 'Re enter-Password: ' HIDE COLUMN next_script_col NEW_VALUE next_script SET TERMOUT OFF SELECT CASE WHEN '&pswd' = '&pswd2' THEN 'change_pswd' ELSE 'ask_pswd' END AS next_script_col FROM dual; SET TERMOUT ON @&next_script
This loop until the two given passwords are the same, how he calls another script, change_pswd, to actually change the password.
-
Hello
I have 11g database. When I do the desc on session of v$ I can see table and select from this point of view.
The question is when I write process I get an error. Pls see below.
I must be missing something. Pls let me know.
Thank you very much
Laba
SQL * more: version 8.0.6.0.0 - Production on Fri Jan 8 10:48:21 2010
(c) Copyright 1999 Oracle Corporation. All rights reserved.
Connected to:
Oracle Database 11g Release 11.1.0.6.0 - Production
SQL > CREATE PROCEDURE ABCD IS
HOLD_NAME 2 VARCHAR2 (100);
3 BEGIN
4. SELECT USERNAME
5 IN HOLD_NAME
6 FROM V$ SESSION
7. WHERE USERNAME = "EDUMET";
8 END;
9.
CAUTION: Procedure created with compilation errors.
SQL > SHOW ERRORS
ABCD PROCEDURAL errors:
LINE/COL ERROR
-------- -----------------------------------------------------------------
4/1 PL/SQL: statement ignored
6/6 PL/SQL: ORA-00942: table or view does not exist
SQL > DESC V$ SESSION
Name Null? Type
------------------------------- -------- ----
SADDR RAW (4)
SID NUMBER
SERIAL NUMBER #.
NUMBER OF AUDSID
PADDR RAW (4)
USER NUMBER #.
NAME VARCHAR2 (30)
ORDER NUMBER
OWNERID NUMBER
........................
.............
SQL > SELECT name from USER OF V$ SESSION;
USERNAME
------------------------------
SYSMAN
EDUMET
SYSMAN
EDUMET
SYSMANEmeric wrote:
SQL * more: release of * 8.0.6 *.0.0 - Production on Fri Jan 8 10:48:21 2010
You should really spend your client to connect to an 11g database, otherwise you could be facing several problems.
That said, you should have the concession on this point of view given directly to your user, not by a role, to use it in a procedure.
SQL> conn titi/titi SQL> CREATE PROCEDURE ABCD IS 2 HOLD_NAME VARCHAR2(100); 3 BEGIN 4 SELECT USERNAME 5 INTO HOLD_NAME 6 FROM V$SESSION 7 WHERE USERNAME = 'EDUMET'; 8 END; 9 / Warning: Procedure created with compilation errors. SQL> show err Errors for PROCEDURE ABCD: LINE/COL ERROR -------- -------------------------------------------------- 4/2 PL/SQL: SQL Statement ignored 6/7 PL/SQL: ORA-00942: table or view does not exist SQL> desc V$SESSION Name Null? Type ----------------------------------------- -------- ----------- SADDR RAW(8) SID NUMBER SERIAL# NUMBER ... SQL> conn / as sysdba SQL> grant select on sys.v_$session to titi; Grant succeeded. SQL> conn titi/titi Connected. SQL> CREATE or replace PROCEDURE ABCD IS 2 HOLD_NAME VARCHAR2(100); 3 BEGIN 4 SELECT USERNAME 5 INTO HOLD_NAME 6 FROM V$SESSION 7 WHERE USERNAME = 'EDUMET'; 8 END; 9 / Procedure created.
Nicolas.
added example
Published by: Gasparotto N on January 8, 2010 17:26
Maybe you are looking for
-
1 email stuck in Outbox - how to remove?
I have an email stuck in my Outbox to the iPhone (now for 2 weeks) 6. There the circle dotted mobile next to him when I try to open it - I don't really know for sure that I created it-all that it shows is a URL to a site I have ever visited. I restar
-
Kodak esp3250 drivers do not install on Windows XP Professional 64-bit
Hello I just want to ask if it is possible to download drivers for my Kodak ESP 3250 printer. I heard that it is not compatible with Windows XP Professional 64-bit machines, but I think that it is not true. Thank you Zuga01
-
CM1312 not FOUND USB installation problem!
The Networkprinter installer not detect USB! New Windows 7 x 64 on a "Zotac CI320" My USB camera have the same problem, I patched the Autorun.inf to install the driver (disable USB check). MinUsbReady = 1 removes the Message "USB driver", but there 2
-
I got my x 230 today and he has three questions: Left button of the mouse makes noise as if there is something of crumpled behind it (similar to the noise if you WAD of paper tissue or waxed paper). Sometimes, it's just a pop (as paper bubble to burs
-
I am trying to install lightroom on my macbook pro. I bought a card with a serial number on this subject and downloaded from the Web site. When I try and install the software it says there is a problem and I would like to download the app to support