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

What is oracle error code for table locks?
How to set headers in SQLPLUS?
How to fetch oracle error codes in a query
How to see stored procedure output on command line via sqlplus [duplicate]
Updating table in SQLPLUS (Stored Procedure Loop with Comma Delimited Column)
Remove a certain string (hint) from SQL code in oracle
Windows cannot find 'http:/.127.0.0.1:%HTTPPORT%/apex/f?p=4950'. Make sure you typed the name correctly, and then try again
Excel VBA ADO Oracle Operation is not allowed when the object is closed
authid definer not working .insufficient privileges
Oracle APEX Interactive Report conditional column link display
Oracle Apex login Twice on the Same App, Machine and Broswer
What are the ways to write a sql script for getting mismatch between source and target datatype
Oracle stored procedure to return a list of ids
vb6 can not connect oracle 11g r2 with ADO but can connect with SQL Developer
Show a sequence generated value in success message upon form submission for Oracle Apex
Oracle tns Pinging error

Categories

HOME
google-chrome
tomcat
paypal-ipn
tcsh
nsview
google-webmaster-tools
google-sheets-query
tibco
capistrano
supercollider
joomla3.2
selection
scrape
nsstring
sap-fiori
business-intelligence
pm2
createjs
squirrel-sql
texas-instruments
user-defined-types
rpmbuild
infrared
unity-container
weex
web-push
xdebug
points
echosign
es6-modules
location-services
wampsharp
epplus
db2-luw
orchardcms-1.8
keyboard-layout
pdfnet
microsoft-ui-automation
xll
django-smart-selects
suds
elasticsearch-aggregation
notesview
apache-toree
nomad
asihttprequest
realstudio
comm
case-when
dex
.when
java-2d
openseadragon
facebook-ios-sdk
jeditable
jemdoc
textblock
vimperator
ibm-was
netdatacontractserializer
hmisc
ipod
console.log
gflags
mxe
findersync
relationships
air-native-extension
pre
jomsocial
ember-table
notin
mongo-jackson-mapper
ckeditor.net
email-verification
linkbutton
spark-view-engine
taskkill
quartz-core
groovy-console
play2-mini
representation
grails-validation
bll
libxslt
aggregator
ixmldomdocument
aspbutton
rational-unified-process
mysqli-multi-query
main-method
inversion
database-cloning
rendering-engine

Resources

Database Users
RDBMS discuss
Database Dev&Adm
javascript
java
csharp
php
android
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App