oracle


Error(30,11): PLS-00103: Encountered the symbol UPDATE error


While creating below SP I am getting the error as
Error(30,11): PLS-00103: Encountered the symbol "UPDATE" when expecting one of the following: ( - + case mod new not null select with continue avg count current exists max min prior sql stddev sum variance execute forall merge time timestamp interval date pipe
Here is my SP
Procedure Update_Link_Details (
P_UDLINKID NVARCHAR2,
P_FOLDERSTRUCTURE NVARCHAR2,
TBL_UPD OUT SYS_REFCURSOR
)
AS
BEGIN
OPEN TBL_UPD FOR
Update Tb_Link_Print
set status='Start'
where LINKPRINTID= P_UDLINKID
and upper(FOLDERSTRUCTURE) LIKE '%' || upper(P_FOLDERSTRUCTURE) || %';
NULL;
END Update_Link_Details;
"I just want to update the table with that status ...Also I want to return the updated record"
That's two things, so it's two statements:
Procedure Update_Link_Details (
P_UDLINKID NVARCHAR2,
P_FOLDERSTRUCTURE NVARCHAR2,
TBL_UPD OUT SYS_REFCURSOR
)
AS
BEGIN
Update Tb_Link_Print
set status='Start'
where LINKPRINTID= P_UDLINKID
and upper(FOLDERSTRUCTURE) LIKE '%' || upper(P_FOLDERSTRUCTURE) || '%';
OPEN TBL_UPD FOR
select * from Tb_Link_Print
where LINKPRINTID= P_UDLINKID
and upper(FOLDERSTRUCTURE) LIKE '%' || upper(P_FOLDERSTRUCTURE) || '%';
END Update_Link_Details;
This is a trifle clunky. Here is a version which engineers away the duplication:
Procedure Update_Link_Details (
P_UDLINKID NVARCHAR2,
P_FOLDERSTRUCTURE NVARCHAR2,
TBL_UPD OUT SYS_REFCURSOR
)
AS
upd_rowids sys.dbms_debug.vc2coll;
BEGIN
Update Tb_Link_Print
set status='Start'
where LINKPRINTID= P_UDLINKID
and upper(FOLDERSTRUCTURE) LIKE '%' || upper(P_FOLDERSTRUCTURE) || '%'
returning rowidtochar(rowid) bulk collect into upd_rowids;
OPEN TBL_UPD FOR
select p.*
from Tb_Link_Print p
join table(upd_rowids) u
on p.rowid = chartorowid(u.column_value)
;
END Update_Link_Details;
It uses the RETURNING clause to capture the ROWIDs of the affected rows, then opens the Ref Cursor using those ROWIDs to restrict the result set.

Related Links

Functional Where-In Clause - Oracle PL/SQL
NULL or BLANK fields (ORACLE)
Facing difficulty in constructing SQL from multiple multi-select listboxes
How to create and use temporary table in oracle stored procedure?
How Do you load a fixed width data file using SQL*Loader which has no Line Delimiter but has fields with newline characters?
What is the correct way to deal with this Oracle ORA-01403: no data found Exception?
Retrieving PL/SQL procedure schema
Finding all statements involved in a deadlock from an Oracle trace file?
how to log statements that execute on an index in oracle?
Oracle - additional column check with min function and group by
Orion's Oracle DB
How to Decompile FMX file
Oracle Timestamp, Max and Minimal Values
Oracle: Convert xml entities in a varchar2 field to utf-8 characters
Oracle SecureFile
What is more optimal in Oracle 11G? Drop Recreate Indexes or just dbms_stats.gather

Categories

HOME
d3.js
transactions
kivy
filesize
mirc
dependencies
openflow
flurry
supercollider
gprs
onvif
outlook-restapi
maven-plugin
significance
jest
social-tables
azure-machine-learning
el
multi-upload
react-bootstrap-table
bobo-browse.net
substance
nic
es6-modules
progid
publishing
osx-lion
bootstrap-sass
bean-validation
spinner
stackpanel
jslint
twilio-php
cartopy
unification
microsoft-ui-automation
assemblies
task-parallel-library
oauth2
coverage.py
sonatype
embedded-v8
android-webservice
pen
sesame
msxml
google-shopping-api
email-injection
yargs
streamwriter
declarative
node.js-connect
static-methods
adp
apache-pig-grunt
node-glob
distributed-cache
verisign
mnesia
accessibilityservice
360-degrees
actionpack
ipod
erlog
subfolder
tidyr
nsmutabledata
maven-shade-plugin
mojo
datagridcomboboxcolumn
dc
nesper
inputbox
back
lmax
webautomation
forio-contour
mod-perl
typesafe-stack
visual-c++-2005
apportable
oscilloscope
xalan
ip-geolocation
uitextfielddelegate
uipangesturerecognizer
mkannotation
motodev-studio
snackjs
getopts
winsxs
sql-parametrized-query
bass
uninstaller
.net-services
bucket
accumulator
activex-exe
error-detection

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App