SP Exec with Execute as
Hi,
Is it possible to execute the Stored Procedure with another user like "Execute as " option ?
Note: Pl not that we can use this option while creating SP, but my doubt only for while executing the SP.
Syntax :
Exec SPNAME Execute as user='Dhanapal';
Thanks inadvance.
Regards,
Dhanpal
Another trick I use is:
EXECUTE( 'EXEC spname' ) AS USER = 'Dhanapal'
Very useful when I am trying statement that doesn't include any strings. I use this one when I want to avoid having to revert after the code execution.
-Raul Garcia
SQL Server Security
This posting is provided "AS IS" with no warranties, and confers no rights.
Similar Messages
-
Problem with execute SSIS package from stored procedure
Hi,
I would like to execute SSIS package from stored procedure. Therefore, I implemented sp which exec SSISDB.CATALOG.CREATE_EXECUTION method. When I try to test it from SSMS on remote server, I got error that
I was able to solve by adding “WITH EXECUTE AS …”. Then I got another error: The server principal "Domain\user" is not able to access the database "SSISDB" under the current security context. On Internet, I found a couple post that describe
how to access SSIS catalog (one of them by Ke Yang -
http://blogs.msdn.com/b/mattm/archive/2012/03/20/ssis-catalog-access-control-tips.aspx). It didn’t help. I’m still getting the error message.
How to debug this issue?
Any suggestion?
Thanks
SQL Server 2014 BISSMS does not propagate user credentials thus the error
Arthur
MyBlog
Twitter -
Stuck On Runtime.exec() with cmd.exe
I've done my best to look through the forums and implement what's been said but I'm getting a problem where my whole Java program freezes when the exec() is executed. Can anyone tell me what I'm missing or have misunderstood ?
try
Process runSmodels = Runtime.getRuntime().exec("C:\\Windows\\System32\\cmd.exe lparse predict.pl | smodels 0");
String smodelsOutput = new String();
BufferedReader smodelsReader = new BufferedReader(new InputStreamReader(runSmodels.getInputStream()));
String outputLine = smodelsReader.readLine();
while(outputLine != null)
smodelsOutput += outputLine;
outputLine = smodelsReader.readLine();
smodelsReader.close();
System.out.println(smodelsOutput);
catch(IOException exc)
JOptionPane.showMessageDialog(rootPane, "Could not access Smodels.", "System Call Error", JOptionPane.ERROR_MESSAGE);
}DarioAtUOW wrote:
Pitfall 1 : Calling .exitValue(). My code doesn't do that.
Pitfall 2 :Not enptying relevant streams. I do empty the input stream.
Pitfall 3 : Assuming a command is an executable program. I don't do that, cmd.exe is in my command string explicitly.
Pitfall 4 : As above in Pitfall 3.
So, why accuse me of not reading the article ? You probably have many years of experience at Java, unlike me, who is just starting out with it at university.Pitfall 2 : Even though you are processing stdout you are not processing stderr! Always always always process both. This may or may not be the cause of your problem but by copying the process stderr to your System.err you may see why your process is stuck.
Even Clippy, the Microsoft Office Assistant, could answer questions better than you have attempted to do.Ouch, I'm cut to the bone on your razor sharp wit. Phuck you. -
Issue with Executing OS commands from Stored Procedure
I am trying to execute the scripts provided at :
http://github.com/xtender/XT_SHELL
provided by xtender user.
As required, I have asked my DBAs to grant privileges by executing the following scripts:
Begin
--change to needed permissions and execute
dbms_java.grant_permission( 'ODS', 'SYS:java.io.FilePermission', '/var/factiva/ODS/bin/CVIM_Rpt_ExportCSVFile’, 'read,write,execute' );
end;
/where CVIM_Rpt_ExportCSVFile is my script residing in the Unix server where my Oracle is installed.
The error I am facing when I try to execute the following command is:
select * from table(xt_shell.shell_exec('/var/scripts/CVIM_Rpt_ExportCSVFile',100))
Exception:the Permission (java.io.FilePermission /var/scripts/CVIM_Rpt_ExportCSVFile execute) has not been granted to ODS. The PL/SQL to grant this is dbms_java.grant_permission( 'ODS', 'SYS:java.io.FilePermission', '/var/scripts/CVIM_Rpt_ExportCSVFile', 'execute' )I have asked my DBA to also execute the following scripts: - But I still see the same error as above. I am not able to figure out whats going on. Can anyone pls help me out??
EXEC Dbms_Java.Grant_Permission('ODS', 'SYS:java.lang.RuntimePermission', 'writeFileDescriptor', '');
EXEC Dbms_Java.Grant_Permission(ODS', 'SYS:java.lang.RuntimePermission', 'readFileDescriptor', '');
dbms_java.grant_permission( 'ODS', 'SYS:java.io.FilePermission', '/var/scripts/CVIM_Rpt_ExportCSVFile', 'execute' )DUPLICATE
===============================================================
Issue with Executing OS commands from Stored Procedure
============================================================== -
EXEC Vs EXECUTE IMMEDIATE IN HANA?
Hi,
Could you please explain me the difference between EXEC and EXECUTE IMMEDIATE (possibly with example?
Thanks,
SreeThanks again Vaibhav !
Yes. I think I got your point while using Dynamic column names and here is the code below, i tried and executed and observed the difference between EXEC and EXECUTE IMMEDIATE.
--Creating a table
CREATE TABLE tab (id int,name nvarchar(20),age integer);
--inserting data into table
insert into tab values(30,'abc',15);
insert into tab values(20,'xyz',17);
insert into tab values(15,'pqr',16);
--creating procedure to perform dynamic sql
CREATE PROCEDURE proc_dynamic_result2(in col1 varchar(20),in col2 varchar(20)) AS
BEGIN
EXECUTE IMMEDIATE 'SELECT ' || :col1 || ','|| :col2 ||' FROM tab ';
END;
--calling procedure
call proc_dynamic_result2('name','id');
call proc_dynamic_result2('id','age');
call proc_dynamic_result2('name','age');
Note: Result is displayed in procedures result iterator, but when I ran with just EXEC result was not displayed in the procedures result iterator .
Thanks,
Sree -
Hi,
My ProC code works fine when I have Exec sql in it but when I include plsql block in it using EXEC SQL EXECUTE, it throws the following error:
/tmp/cc88UGZa.o(.text+0x2c0): In function `main':
: undefined reference to `ECPGget_sqlca'
I have included all these below header files:
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <sqlca.h>
#include <sqlda.h>
#include <sqlcpr.h>
and the path have been mentioned in pcscfg.cfg as well.
what can be the reason and the solution to this please? Help is appreciated.
Thanks in advance!
AshYou have to use 'BEGIN procedure_name END' in the execute statement while calling PL/SQL Procedures
EXEC SQL EXECUTE
DECLARE
BEGIN
END;
END-EXEC; -
Strange problem with executing PL/SQL procedure from sqlplus.
Hello,
basicly, I'm strugling with executing a procedure written in PL/SQL from sqlplus.
It's all because I convert a data in procedure by other function.
SELECT partition_name
INTO strpartition
FROM user_tab_partitions
WHERE table_name = tablename_in
and substr(partition_name, -8, length(partition_name)) = (SELECT F_CONVERT_DATE(tablename_in,p_date) from dual);
/tablename_in and p_date are input parameters/
Function F_CONVERT_DATE looks more less like :
select
TO_CHAR(TRUNC(NEXT_DAY(ADD_MONTHS(substr(partition_name, -8, length(partition_name)), -3), 'MONDAY')-7), 'YYYYMMDD')
END
AS p_date
INTO v_okr
FROM user_tab_partitions
where substr(partition_name, -8, length(partition_name)) = p_date;
Well, the thing is that procedure is executable from TOAD without any errors !! But when I try to execute it straight from sqlplus it returns:
ORA-01861: literal does not match format string
ORA-06512: at "F_CONVERT_DATE", line 13
ORA-06512: at "NAME_OF_PROCEDURE", line 17
Tip: When I don't use functions ADD_MONTHS, NEXT_DAY and TO_CHAR in function F_CONVERT_DATE sqlplus can execute it. But only when I use them it returns an error.
Anybody has a clue how to solve it?
Regards !Hi, Nodex,
Avoid implicit conversions.
For example:
TO_CHAR(TRUNC(NEXT_DAY(ADD_MONTHS(substr(partition_name, -8, length(partition_name)), -3), 'MONDAY')-7), 'YYYYMMDD')ADD_MONTHS expects a DATE as its first argument.
SUBSTR returns a VARCHAR2, so you're calling ADD_MONTHS with a VARCHAR2 where it expects a DATE.
For good or ill, the system tries to avoid raising an error in this case by implicitly converting the VARCHAR2 to a DATE. Exactly how it does that depends on
(a) the tool you are using (SQL*Plus or Toad, for example),
(b) the version (Oracle 10 behaved quite different form Oracle 9),
(c) environmental settings (such as NLS_DATE_FORMAT), which in turn may depend on initialization parameneters, and
(d) who knows what else.
When you have to convert, do so explicitly.
You can convert a VARCHAR2 to a DATE using TO_DATE, like this:
TO_CHAR ( TRUNC ( NEXT_DAY ( ADD_MONTHS ( TO_DATE ( SUBSTR ( partition_name
, -8
, LENGTH (partition_name)
, 'YYYYMMDD' -- or whatever
, -3
, 'MONDAY'
- 7
, 'YYYYMMDD'
) -
Pipelined Function with execute immediate
Hello Experts,
I have created a Pipe lined function with execute immediate, due to below requirement;
1) Columns in where clause is passed dynamically.
2) I want to know the data stored into above dynamic columns.
3) I want to use it in report, so I don't want to insert it into a table.
I have created a TYPE, then through execute immediate i have got the query and result of that query will be stored in TYPE.
But when calling the function i am getting
ORA-00932: inconsistent datatypes: expected - got -
Below is my function and type, let me know i am going wrong, and is my logic correct.
CREATE OR REPLACE TYPE OBJ_FPD AS OBJECT
(LOW_PLAN_NO VARCHAR2 (40),
FPD VARCHAR2 (5),
SERIAL_NO NUMBER,
CEDIA_CODE VARCHAR2 (2),
DT DATE);
CREATE OR REPLACE TYPE FPD_TBL_TYPE AS TABLE OF OBJ_FPD;
CREATE OR REPLACE FUNCTION FUNC_GET_FPD_DATE (P_LOW_PLAN_NO VARCHAR2,
P_CEDIA_CODE VARCHAR2,
P_SERIAL_NO NUMBER)
RETURN FPD_TBL_TYPE
PIPELINED
AS
CURSOR C1
IS
SELECT 'FPD' || LEVEL TBL_COL
FROM DUAL
CONNECT BY LEVEL <= 31;
V_STR VARCHAR2 (5000);
V_TBL_TYPE FPD_TBL_TYPE;
BEGIN
FOR X IN C1
LOOP
V_STR :=
'SELECT A.low_PLAN_NO,
A.FPD,
A.SERIAL_NO,
A.cedia_code,
TO_DATE (
SUBSTR (FPD, 4, 5)
|| ''/''
|| TO_CHAR (C.low_PLAN_PERIOD_FROM, ''MM'')
|| ''/''
|| TO_CHAR (C.low_PLAN_PERIOD_FROM, ''RRRR''),
''DD/MM/RRRR'')
DT FROM ( SELECT low_PLAN_NO, '
|| ''''
|| X.TBL_COL
|| ''''
|| ' FPD, '
|| X.TBL_COL
|| ' SPTS, SERIAL_NO, cedia_code FROM M_low_PLAN_DETAILS WHERE NVL('
|| X.TBL_COL
|| ',0) > 0 AND SERIAL_NO = '
|| P_SERIAL_NO
|| ' AND cedia_code = '
|| ''''
|| P_CEDIA_CODE
|| ''''
|| ' AND low_PLAN_NO = '
|| ''''
|| P_LOW_PLAN_NO
|| ''''
|| ') A,
M_low_PLAN_DETAILS B,
M_low_PLAN_MSTR C
WHERE A.low_PLAN_NO = B.low_PLAN_NO
AND A.cedia_code = B.cedia_code
AND A.SERIAL_NO = B.SERIAL_NO
AND B.low_PLAN_NO = C.low_PLAN_NO
AND B.CLIENT_CODE = C.CLIENT_CODE
AND B.VARIANT_CODE = C.VARIANT_CODE
CONNECT BY LEVEL <= SPTS';
EXECUTE IMMEDIATE V_STR INTO V_TBL_TYPE;
FOR I IN 1 .. V_TBL_TYPE.COUNT
LOOP
PIPE ROW (OBJ_FPD (V_TBL_TYPE (I).LOW_PLAN_NO,
V_TBL_TYPE (I).FPD,
V_TBL_TYPE (I).SERIAL_NO,
V_TBL_TYPE (I).CEDIA_CODE,
V_TBL_TYPE (I).DT));
END LOOP;
END LOOP;
RETURN;
EXCEPTION
WHEN OTHERS
THEN
RAISE_APPLICATION_ERROR (-20000, SQLCODE || ' ' || SQLERRM);
RAISE;
END;Waiting for your views.
Regards,Ora Ash wrote:
Hello Experts,
I have created a Pipe lined function with execute immediate, due to below requirement;
1) Columns in where clause is passed dynamically.No, that's something you've introduced, and is due to poor database design. You appear to have columns on your table called FPD1, FPD2 ... FPD31. The columns do not need to be 'passed dynamically'
2) I want to know the data stored into above dynamic columns.And you can know the data without it being dynamic.
3) I want to use it in report, so I don't want to insert it into a table.That's fine, though there's no reason to use a pipelined function.
You also have an pointless exception handler, which masks any real errors.
I'm not quite sure what the point of your "connect by" is in your query as we don't have your tables or data or know for sure what the expected output is.
However, in terms of handling the 'dynamic' part that you've introduced, then you would be looking at doing something along the following lines, using a static query that requires no poor dynamic code, and no pipelined function...
with x as (select level as dy from dual connect by level <= 31)
select a.low_plan_no
,a.fpd
,a.serial_no
,a.cedia_code
,trunc(c.low_plan_period_from)+a.dy-1 as dt
from (select low_plan_no
,dy
,'FPD'||dy as fpd
,spts
,serial_no
,cedia_code
from (
select low_plan_no
,x.dy
,case x.dy when 1 then fpd1
when 2 then fpd2
when 3 then fpd3
when 4 then fpd4
when 5 then fpd5
when 6 then fpd6
when 7 then fpd7
when 8 then fpd8
when 9 then fpd9
when 10 then fpd10
when 11 then fpd11
when 12 then fpd12
when 13 then fpd13
when 14 then fpd14
when 15 then fpd15
when 16 then fpd16
when 17 then fpd17
when 18 then fpd18
when 19 then fpd19
when 20 then fpd20
when 21 then fpd21
when 22 then fpd22
when 23 then fpd23
when 24 then fpd24
when 25 then fpd25
when 26 then fpd26
when 27 then fpd27
when 28 then fpd28
when 29 then fpd29
when 30 then fpd30
when 31 then fpd31
else null
end as spts
,serial_no
,cedia_code
from x cross join m_low_plan_details
where serial_no = p_serial_no
and cedia_code = p_cedia_code
and low_plan_no = p_low_plan_no
where nvl(spts,0) > 0
) A
join m_low_plan_details B on ( A.low_plan_no = B.low_plan_no
and A.cedia_code = B.cedia_code
and A.serial_no = B.serial_no
join m_low_plan_mstr C on ( B.low_plan_no = C.low_plan_no
and B.client_code = C.client_code
and B.variant_code = C.variant_code
connect by level <= spts;... so just remind us again why you think it needs to be dynamic? -
Database access issue with EXECUTE AS with impersonated User account
Hello,
I have been facing one issue with EXECUTE AS option in SQL Server 2008 R2. Following is the scenario:
I have two databases TestDB1 and TestDB2 on the same SQL Server instance. I have SQL Admin level permissions on the server. I have written a stored procedure in TestDB1 which will execute the scripts(SELECT Statement) againest the table from TestDB2(using
three part query). To execute the proc from TestDB1 I have used EXECUTE AS option with a user (User1) having select permissions on table from TestDB2. The same proc working fine when I use table from TestDB1 but not working on TestDB2 database. Thorwing error
saying permission denied. I have tried enabling the Ownership chains on both the databases but no luck.
Please help me with the situation here.
Thanks!
Swami A Polnati.You can also use EXECUTE AS. But then you need to set the database trustworthy, which is not good for security reasons.
Enabling cross-database chaining will not help, since you are using dynamic SQL.
Dan was kind to point you to my article. I recommend that you read it, and learn to embrace the technique with certificates. Yes, it is a long article and I understand that you are impatient to get a solution quickly. However, the article is written from
the point of view that the reader is interested in learning for the future and not only get a solution for the moment. Certificate-signing as a technique is very very useful in several contexts.
The article does also discuss EXECUTE AS, and I discuss in more detail why setting the database trustworthy may be a security risk. (And as long you don't fully understand what I'm talking about, it is a security risk.)
Erland Sommarskog, SQL Server MVP, [email protected] -
Test sequences not working in standard prototype adaptor with Execute Steps in process
Test sequences not working in standard prototype adaptor with "Execute Steps in process" but the sequences works in "Execute steps in an External instance of CVI"(Debug mode). Pl help with solution
Apriciate your help
Regards,
SharanuSharanu,
Thanks for contacting National Instruments. It would help us out a lot if you could specify exactly what is not working. Will the sequence just not run? Is it giving you an error message? Or what exactly does not work about it? The initial thing that I could think of that would make it not work in External Instance but not using the RunTime Engine is that you might be missing a support library when trying to run it in this configuration. If you click on the "Configure Auto-Loading of Support Libraries Needed for Linking .objs and .libs" button, you can make sure that all the support libraries you might be using are added in this list (you can add them using the "Add Other Libraries..." button). If this does not fix your problem, then let us know a litt
le more about what is going on and we can help you from there. Thanks.
Adam B.
Applications Engineer
National Instruments -
Issues with Executing Javascript command in Captivate
Hi,
I am having issues with executing javascript for a button in adobe captivate 5. Let me explain what I am trying to do. I am working on a WBT that has three skill checks throught the course. These skill checks are not graded or tracked for completion. I currently have an image button that has the command "Open another project" The first image button is pointed to SkillCheck1 and I have the html file and swf file in the published root folder. This currently works fine.
However I want to use javascript to open a new window 800X600 with not toolbars at the top. I got this part working with the code below:
window.open('http://www.adobe.com','mywin',
'left=40,top=40,width=800,height=600,toolbar=1,resizable=0');
My only problem is, once the popup opens, my WBT goes to a page that says [object] and thats it. I am uploading two images to show what I have. Can someone help resolve my issue of the WBT going toOk so I took this link and viewed over it. I am new to Javascript and know very little about it. Therefore this script kind of makes no sense to me.
<script language="JavaScript"><!--
var windowHandle = '';
function myOpen(url,name,attributes) {
windowHandle = window.open(url,name,attributes);
//--></script>
<a href="javascript:myOpen('page.htm','windowName','height=100,width=100')">text link</a>
I chose the option to exectute javascript. Does captivate need all of this including <script language=JavaScript"> Here is how I edited the script. Should I make any changes to what is in bold?
var windowHandle = '';
function myOpen(url,name,attributes) {
windowHandle = window.open(url,name,attributes);
<a href="javascript:myOpen('http://www.adobe.com','Adobe Website','height=600,width=800')">text link</a> -
Sequence.nextval doubles the returned value with Execute Statement (F9)
There appears to be a quirk with sequences in Raptor.
Has anyone noticed that depending on how you execute this sql (SELECT MYSEQ.NEXTVAL FROM DUAL;) the value returned is either the correct nextval or double what you expected?
For example, MYSEQ is a simple sequence which increments by 1. If you Execute Statement (F9) then the value returned jumps by 2 instead of 1. If you Run Script (F5) then the value returns jumps by 1, as expected.
If MYSEQ is changed to increment by 2. The when you Execute Statement (F9) then the value returned jumps by 4 instead of 2. If you Run Script (F5) then the value returns jumps by 2, as expected. No matter what you put for the increment by Execute Statement (F9) always doubles it.
It always seems to be double. Executing the same scenario in TOAD always returns the correct value (i.e. properly increments).
Is the query being executed multiple times with Execute Statement? Why is this happening?While there is no guarantee from Oracle that sequences produce sequential numbers, this is obviously a case where SQL Developer is running the select statement twice.
The issue is that queries can actually change information, rather than just retrieve data from the database.
The following package is a test case:
create or replace package test_query is
function get_next_count return number;
end;
create or replace package body test_query is
cnt number := 0;
function get_next_count return number is
begin
cnt := cnt + 1;
return cnt;
end;
end;
select test_query.get_next_count from dual;
This query, which should return 1, 2, 3, 4, etc actually returns 2, 4, 6, 8, etc, because SQL Developer is running the select twice. -
What is "with execute as caller" in SP?
What is "with execute as caller" in SP?
What is the purpose of this command?
Thanks in advance.Here is the explanation
http://msdn.microsoft.com/en-us/library/ms188354.aspx
CALLER
Specifies the statements inside the module are executed in the context of the caller of the module. The user executing the module must have appropriate permissions not only on the module itself, but also on any database objects that are referenced by the module.
CALLER is the default for all modules except queues, and is the same as SQL Server 2005 behavior.
CALLER cannot be specified in a CREATE QUEUE or ALTER QUEUE statement.
Satheesh
My Blog |
How to ask questions in technical forum -
Transaction control with execute immediate
Hi, What is the correct way to commit/ rollback transactions when executing a dynamic update statement with execute immediate?
Hi Thanks fo the reply, they don't appear to be. here's my procedure. Is there anything the is obviously wrong?
PROCEDURE p_move_city_numerics ( p_mode IN VARCHAR2,
p_schema IN VARCHAR2,
p_table IN VARCHAR2,
p_destination IN VARCHAR2,
p_city_name IN VARCHAR2,
p_outcome OUT VARCHAR2)
IS
l_valid_object VARCHAR2(200);
l_error_msg VARCHAR2(200);
l_outcome VARCHAR2(2000);
l_sql_count VARCHAR2(2000);
l_sql_update VARCHAR2(2000);
l_record_count NUMBER;
e_object_error EXCEPTION;
BEGIN
l_valid_object := f_is_city_valid (p_schema, p_table, p_destination);
IF l_valid_object != 'VALID' THEN
RAISE e_object_error;
END IF;
l_sql_count := 'SELECT COUNT(*) FROM ' || p_schema || '.' || p_table;
l_sql_count := l_sql_count || ' WHERE UPPER(city) LIKE ' || '''' || '%' || UPPER(p_city_name) || '%' || '''';
l_sql_count := l_sql_count || ' AND ( city LIKE ' || '''' || '%1%' || '''';
l_sql_count := l_sql_count || ' OR city LIKE ' || '''' || '%2%' || '''';
l_sql_count := l_sql_count || ' OR city LIKE ' || '''' || '%3%' || '''';
l_sql_count := l_sql_count || ' OR city LIKE ' || '''' || '%4%' || '''';
l_sql_count := l_sql_count || ' OR city LIKE ' || '''' || '%5%' || '''';
l_sql_count := l_sql_count || ' OR city LIKE ' || '''' || '%6%' || '''';
l_sql_count := l_sql_count || ' OR city LIKE ' || '''' || '%7%' || '''';
l_sql_count := l_sql_count || ' OR city LIKE ' || '''' || '%8%' || '''';
l_sql_count := l_sql_count || ' OR city LIKE ' || '''' || '%9%' || '''';
l_sql_count := l_sql_count || ' OR city LIKE ' || '''' || '%0%' || '''' || ')';
l_sql_update := 'UPDATE ' || p_schema || '.' || p_table;
l_sql_update := l_sql_update || ' SET ' || p_destination || ' = city,';
l_sql_update := l_sql_update || ' city = ' || '''' || p_city_name || '''';
l_sql_update := l_sql_update || ' WHERE UPPER(city) LIKE ' || '''' || '%' || UPPER(p_city_name) || '%' || '''';
l_sql_update := l_sql_update || ' AND ( city LIKE ' || '''' || '%1%' || '''';
l_sql_update := l_sql_update || ' OR ciity LIKE ' || '''' || '%2%' || '''';
l_sql_update := l_sql_update || ' OR city LIKE ' || '''' || '%3%' || '''';
l_sql_update := l_sql_update || ' OR city LIKE ' || '''' || '%4%' || '''';
l_sql_update := l_sql_update || ' OR city LIKE ' || '''' || '%5%' || '''';
l_sql_update := l_sql_update || ' OR city LIKE ' || '''' || '%6%' || '''';
l_sql_update := l_sql_update || ' OR city LIKE ' || '''' || '%7%' || '''';
l_sql_update := l_sql_update || ' OR city LIKE ' || '''' || '%8%' || '''';
l_sql_update := l_sql_update || ' OR city LIKE ' || '''' || '%9%' || '''';
l_sql_update := l_sql_update || ' OR city LIKE ' || '''' || '%0%' || '''' || ')';
IF p_mode = 'SELECT' THEN
EXECUTE IMMEDIATE(l_sql_count) INTO l_record_count;
l_outcome := TO_CHAR(l_record_count) || ' records to be updated!';
ELSIF p_mode = 'UPDATE' THEN
EXECUTE IMMEDIATE(l_sql_count) INTO l_record_count;
EXECUTE IMMEDIATE(l_sql_update);
l_outcome := TO_CHAR(l_record_count) || ' records have been updated!';
COMMIT;
ELSE
l_outcome := ' ERROR - Invalid mode: ' || p_mode || ' has been passed into the function! Valid values are SELECT or UPDATE';
END IF;
EXCEPTION
WHEN e_object_error THEN
IF l_valid_object = 'INVALID_TABLE' THEN
l_outcome := 'ERROR - Not a valid table name: ' || p_schema || '.' || p_table;
ELSIF l_valid_object = 'INVALID_CITY' THEN
l_outcome := 'ERROR - CITY not a valid field in the table: ' || p_schema || '.' || p_table;
ELSIF l_valid_object = 'INVALID_DEST' THEN
l_outcome := 'ERROR - Destination field: ' || p_destination || ' is not a valid field in the table: ' || p_schema || '.' || p_table;
END IF;
WHEN OTHERS THEN
l_error_msg := SQLCODE || '-' || SUBSTR(SQLERRM, 1, 150);
l_outcome := 'ERROR - ' || l_error_msg;
ROLLBACK;
END p_move_city_numerics; -
can somebody help ?
How to use CLOB with Execute immediateHow to use CLOB with Execute immediateeither
1) Upgrade to 11g
2) Convert to varchar2(32767)
3) use dbms_sql with a varchar2 array
Maybe you are looking for
-
I'm working on a program that asks for the users name. after that its supposed to pull the current date and time and print that into a file along with the users name. my problem is when i open the .txt file i get several characters i dont recogize an
-
How can I select 3 movie files and have them played back2back in QTX?
I have been trying to use automater to play two movies that are a series bak to back but it would not do it. I selected the movies, selected program, how many times to loop and to be in full sceen, but still no luck. I would think this would be a sim
-
Connecting external display to 2009 iMac 27" - resolution?
I have a late-2009 27" iMac and am trying to connect to it a 27" external display (ASUS PB278Q). Both the iMac and the Asus have resolution of 2560x1440, but when I connect them, the best I can get on the ASUS is 1920x1080. I am connecting via the Ma
-
HTML Files in portal that access relative images
We put html files on some of our pages. These open up and display their contents, which include images. These images we store on the same portal page (but hide them) so the html page has access to them in the same directory. So, we basically, use a p
-
ITunes only works in 64 bit mode and older movies doesn`t play
Hello, I have ~400 movies, including tv shows and movies, but from the last iTunes updated, I cannot play my library or add news movies, not from iTunes menu ou using iFlicks as always did. And my home sharing didn`t working anymore. I read googled a