<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Errors while creating procedure in Oracle in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/errors-while-creating-procedure-in-oracle/m-p/2979840#M922083</link>
    <description>Hi.&lt;BR /&gt;&lt;BR /&gt;From time to time I run DML to identify what is going on in the database, the dml decodes some of the codes into text.  I am now trying to create a procedure to do this using the following script, but I get an error. I run this script as system.  Can anybody tell me what I am doing wrong.  &lt;BR /&gt;&lt;BR /&gt;Thanks in advance.&lt;BR /&gt;&lt;BR /&gt;Dave&lt;BR /&gt;&lt;BR /&gt;create or replace procedure curr_db_activity is&lt;BR /&gt;begin&lt;BR /&gt;SELECT sid, serial#, username,&lt;BR /&gt;DECODE(command, 0, 'None', 2, 'Insert', 3,&lt;BR /&gt;'Select', 6, 'Update', 7, 'Delete', 8, 'Drop', 'Other')&lt;BR /&gt;command from v$session where type &amp;lt;&amp;gt; 'BACKGROUND';&lt;BR /&gt;end;&lt;BR /&gt;/&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Warning: Procedure created with compilation errors.&lt;BR /&gt;&lt;BR /&gt;SQL&amp;gt; show errors&lt;BR /&gt;Errors for PROCEDURE CURR_DB_ACTIVITY:&lt;BR /&gt;&lt;BR /&gt;LINE/COL ERROR&lt;BR /&gt;-------- -----------------------------------------------------------------&lt;BR /&gt;3/1 PL/SQL: SQL Statement ignored&lt;BR /&gt;6/14 PLS-00201: identifier 'SYS.V_$SESSION' must be declared&lt;BR /&gt;</description>
    <pubDate>Thu, 22 May 2003 13:42:15 GMT</pubDate>
    <dc:creator>Dave Walley</dc:creator>
    <dc:date>2003-05-22T13:42:15Z</dc:date>
    <item>
      <title>Errors while creating procedure in Oracle</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/errors-while-creating-procedure-in-oracle/m-p/2979840#M922083</link>
      <description>Hi.&lt;BR /&gt;&lt;BR /&gt;From time to time I run DML to identify what is going on in the database, the dml decodes some of the codes into text.  I am now trying to create a procedure to do this using the following script, but I get an error. I run this script as system.  Can anybody tell me what I am doing wrong.  &lt;BR /&gt;&lt;BR /&gt;Thanks in advance.&lt;BR /&gt;&lt;BR /&gt;Dave&lt;BR /&gt;&lt;BR /&gt;create or replace procedure curr_db_activity is&lt;BR /&gt;begin&lt;BR /&gt;SELECT sid, serial#, username,&lt;BR /&gt;DECODE(command, 0, 'None', 2, 'Insert', 3,&lt;BR /&gt;'Select', 6, 'Update', 7, 'Delete', 8, 'Drop', 'Other')&lt;BR /&gt;command from v$session where type &amp;lt;&amp;gt; 'BACKGROUND';&lt;BR /&gt;end;&lt;BR /&gt;/&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Warning: Procedure created with compilation errors.&lt;BR /&gt;&lt;BR /&gt;SQL&amp;gt; show errors&lt;BR /&gt;Errors for PROCEDURE CURR_DB_ACTIVITY:&lt;BR /&gt;&lt;BR /&gt;LINE/COL ERROR&lt;BR /&gt;-------- -----------------------------------------------------------------&lt;BR /&gt;3/1 PL/SQL: SQL Statement ignored&lt;BR /&gt;6/14 PLS-00201: identifier 'SYS.V_$SESSION' must be declared&lt;BR /&gt;</description>
      <pubDate>Thu, 22 May 2003 13:42:15 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/errors-while-creating-procedure-in-oracle/m-p/2979840#M922083</guid>
      <dc:creator>Dave Walley</dc:creator>
      <dc:date>2003-05-22T13:42:15Z</dc:date>
    </item>
    <item>
      <title>Re: Errors while creating procedure in Oracle</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/errors-while-creating-procedure-in-oracle/m-p/2979841#M922084</link>
      <description>When scripting you sometimes have issue with special characters.&lt;BR /&gt;&lt;BR /&gt;The $ in SYS.V_$SESSION requires a special character in perl to work correctly in a script.&lt;BR /&gt;&lt;BR /&gt;SYS.V_\$SESSION  I think&lt;BR /&gt;&lt;BR /&gt;Same deal with v$session, even in shell scripting.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Here is an example.&lt;BR /&gt;&lt;BR /&gt;perl&lt;BR /&gt;&lt;BR /&gt;#!/usr/contrib/bin/perl&lt;BR /&gt;&lt;BR /&gt;#$Argument = ($ARGV[0]);&lt;BR /&gt;&lt;BR /&gt;$sqlstring = 'select username,status,logon_time,program,osuser from v\$session;'&lt;BR /&gt;;&lt;BR /&gt;&lt;BR /&gt;#print "${Argument}\n";&lt;BR /&gt;$DML =&amp;lt;&lt;EODML&gt;&lt;/EODML&gt;manager/manager1@jufsys&lt;BR /&gt;ttitle center 'User Session Report:' skip 2&lt;BR /&gt;column username  format a8 heading 'Name' trunc&lt;BR /&gt;column status  format a8 heading 'Status' trunc&lt;BR /&gt;column logon_time format a8 heading 'Start' trunc&lt;BR /&gt;column program format a44 heading 'Program' trunc&lt;BR /&gt;column osuser format a8 heading 'OS-User' trunc&lt;BR /&gt;set pagesize 24&lt;BR /&gt;set linesize 80&lt;BR /&gt;$sqlstring&lt;BR /&gt;eodml&lt;BR /&gt;$Input = `echo "$DML" | sqlplus`;&lt;BR /&gt;print $Input;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;shell scripting&lt;BR /&gt;&lt;BR /&gt;   1  #!/bin/ksh&lt;BR /&gt;     2&lt;BR /&gt;     3  echo `date` &amp;gt;&amp;gt; /utmp/oracle/database.log&lt;BR /&gt;     4  ORACLE_SID=jufdev&lt;BR /&gt;     5  . /usr/contrib/bin/setOraProfile&lt;BR /&gt;     6&lt;BR /&gt;     7&lt;BR /&gt;     8  sqlplus internal &amp;lt;&amp;lt; EOFTOP&lt;BR /&gt;     9  alter system switch logfile;&lt;BR /&gt;    10  exit;&lt;BR /&gt;    11  EOFTOP&lt;BR /&gt;    12&lt;BR /&gt;    13  ORACLE_SID=juftest&lt;BR /&gt;    14  . /usr/contrib/bin/setOraProfile&lt;BR /&gt;    15&lt;BR /&gt;    16&lt;BR /&gt;    17  sqlplus internal &amp;lt;&amp;lt; EOFBOT&lt;BR /&gt;    18  alter system switch logfile;&lt;BR /&gt;    19  exit;&lt;BR /&gt;    20  EOFBOT&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Just examples of proper shell scripting technique.&lt;BR /&gt;&lt;BR /&gt;I think its the dollar signs.&lt;BR /&gt;&lt;BR /&gt;SEP&lt;BR /&gt;</description>
      <pubDate>Thu, 22 May 2003 13:57:48 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/errors-while-creating-procedure-in-oracle/m-p/2979841#M922084</guid>
      <dc:creator>Steven E. Protter</dc:creator>
      <dc:date>2003-05-22T13:57:48Z</dc:date>
    </item>
    <item>
      <title>Re: Errors while creating procedure in Oracle</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/errors-while-creating-procedure-in-oracle/m-p/2979842#M922085</link>
      <description>hi,&lt;BR /&gt;&lt;BR /&gt;v$session is a synonym for 'SYS.V_$SESSION' &lt;BR /&gt;&lt;BR /&gt;either you:&lt;BR /&gt;1. grant dba to yourself&lt;BR /&gt;2. as user SYS, grant select on SYS.V_$SESSION to the user in question.&lt;BR /&gt;&lt;BR /&gt;this should fix that&lt;BR /&gt;&lt;BR /&gt;regards&lt;BR /&gt;Yogeeraj</description>
      <pubDate>Thu, 22 May 2003 14:13:46 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/errors-while-creating-procedure-in-oracle/m-p/2979842#M922085</guid>
      <dc:creator>Yogeeraj_1</dc:creator>
      <dc:date>2003-05-22T14:13:46Z</dc:date>
    </item>
    <item>
      <title>Re: Errors while creating procedure in Oracle</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/errors-while-creating-procedure-in-oracle/m-p/2979843#M922086</link>
      <description>hi again,&lt;BR /&gt;&lt;BR /&gt;a quote from my notes:&lt;BR /&gt;&lt;BR /&gt;&lt;QUOTE&gt;&lt;BR /&gt;In order to create a trigger or procedure that references v$session, you need to:&lt;BR /&gt;&lt;BR /&gt;SQL&amp;gt; grant select on v_$session to &lt;OWNER of="" the="" procedure=""&gt;&lt;BR /&gt;&lt;BR /&gt;when connected as SYS.  v_$session is a view and can be granted on.  v$session is a synonym for that view (and hence cannot be granted on, thats why you grant on v_$session, not v$session). &lt;BR /&gt;&lt;BR /&gt;....&lt;BR /&gt;&lt;BR /&gt;Some people create a view:&lt;BR /&gt;&lt;BR /&gt;create view my_session_info&lt;BR /&gt;as&lt;BR /&gt;select * from V$session where audsid = userenv('sessionid');&lt;BR /&gt;&lt;BR /&gt;grant select on my_session_info to public;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;as SYS so everyone can see their session.  You would be able to use that grant and view in your procedure|trigger as well.&lt;BR /&gt;&lt;BR /&gt;&lt;/OWNER&gt;&lt;BR /&gt;&lt;BR /&gt;hope this helps!&lt;BR /&gt;&lt;BR /&gt;regards&lt;BR /&gt;Yogeeraj&lt;/QUOTE&gt;</description>
      <pubDate>Thu, 22 May 2003 14:23:39 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/errors-while-creating-procedure-in-oracle/m-p/2979843#M922086</guid>
      <dc:creator>Yogeeraj_1</dc:creator>
      <dc:date>2003-05-22T14:23:39Z</dc:date>
    </item>
  </channel>
</rss>

