Assistance needed for a syntax error with my simple PL/SQLAre there alternative methods for saying 'next' in a pl/sql for loop?compile error when creating an “instead of” trigger for a viewhow to fetch cursor value into varchar2 in pl/sqlOracle SQL Injection Block with DBMS_ASSERTSimple PL/SQL to check if table exists is not workingPass value stored in a PL/SQL variable into an IN clausePL SQL LOOP logic if else ifRemoving PL/SQL Code from Oracle spoolWhat is the purpose of the checks like 'VARCHAR2' = 'NUMBER' in auto-generated sqldeveloper scripts?Storing SQL select as variable and diff later with another select
Is killing off one of my queer characters homophobic?
How can I legally visit the United States Minor Outlying Islands in the Pacific?
What does "Fotze" really mean?
Why the term 'unified' in "unified mass unit"?
Why hasn't the U.S. government paid war reparations to any country it attacked?
Is this floating-point optimization allowed?
Would letting a multiclass character rebuild their character to be single-classed be game-breaking?
What is the German equivalent of 干物女 (dried fish woman)?
Why would guns not work in the dungeon?
Filtering fine silt/mud from water (not necessarily bacteria etc.)
If the derivative of a function is square of it then it is constant
QGIS Linestring rendering curves between vertex
How to repair a laptop's screen hinges?
Are lithium batteries allowed in the International Space Station?
What does `[$'rn']` mean?
What are some symbols representing peasants/oppressed persons fighting back?
What is this welding tool I found in my attic?
Do native speakers use ZVE or CPU?
Draw 3D Cubes around centre
Why would an Inquisitive rogue choose to use Insightful Fighting as opposed to using their Cunning Action to Hide?
Why does the autopilot disengage even when it does not receive pilot input?
Can I call 112 to check a police officer's identity in the Czech Republic?
Cubic programming and beyond?
What is temperature on a quantum level?
Assistance needed for a syntax error with my simple PL/SQL
Are there alternative methods for saying 'next' in a pl/sql for loop?compile error when creating an “instead of” trigger for a viewhow to fetch cursor value into varchar2 in pl/sqlOracle SQL Injection Block with DBMS_ASSERTSimple PL/SQL to check if table exists is not workingPass value stored in a PL/SQL variable into an IN clausePL SQL LOOP logic if else ifRemoving PL/SQL Code from Oracle spoolWhat is the purpose of the checks like 'VARCHAR2' = 'NUMBER' in auto-generated sqldeveloper scripts?Storing SQL select as variable and diff later with another select
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I'm calling a db link with some PL/SQL and I'm having issues with commas and pipes. I've tried multiple combinations but keep getting syntax errors.
I've tried multiple commas all over the place, to no avail :-(
declare
v_sql varchar2(4000);
s_sql varchar2(4000);
l_dblink varchar2(100) := 'DB1';
begin
for c in (select * from my_table)
loop
if
c.blue_table is not null
then v_sql :=
'select count(*) from' ||c.schema||'.'||c.table||'@'||'l_dblink;
execute immediate v_sql into s_sql;
dbms_output.put_line(s_sql);
end if;
end loop;
end;
/
I'm expecting it to loop through the table 'my_table'. put together 'SCHEMA.TABLE_NAME' and give me a row count.
oracle plsql
add a comment |
I'm calling a db link with some PL/SQL and I'm having issues with commas and pipes. I've tried multiple combinations but keep getting syntax errors.
I've tried multiple commas all over the place, to no avail :-(
declare
v_sql varchar2(4000);
s_sql varchar2(4000);
l_dblink varchar2(100) := 'DB1';
begin
for c in (select * from my_table)
loop
if
c.blue_table is not null
then v_sql :=
'select count(*) from' ||c.schema||'.'||c.table||'@'||'l_dblink;
execute immediate v_sql into s_sql;
dbms_output.put_line(s_sql);
end if;
end loop;
end;
/
I'm expecting it to loop through the table 'my_table'. put together 'SCHEMA.TABLE_NAME' and give me a row count.
oracle plsql
Some bell end has voted this down - why?
– Scouse_Bob
Mar 26 at 5:58
1
Not sure abt the downvote, but you seem to have an extra'
after'@'||
– Kaushik Nayak
Mar 26 at 6:08
Maybe somebody downvoted because you didn't explain what the error message is or nor what line it occurs.
– GolezTrol
Mar 26 at 6:15
2
You're also missing a space in your string concat.from
and the schema name are stuck together.
– GolezTrol
Mar 26 at 6:16
Legend. Sorted!
– Scouse_Bob
Mar 26 at 6:27
add a comment |
I'm calling a db link with some PL/SQL and I'm having issues with commas and pipes. I've tried multiple combinations but keep getting syntax errors.
I've tried multiple commas all over the place, to no avail :-(
declare
v_sql varchar2(4000);
s_sql varchar2(4000);
l_dblink varchar2(100) := 'DB1';
begin
for c in (select * from my_table)
loop
if
c.blue_table is not null
then v_sql :=
'select count(*) from' ||c.schema||'.'||c.table||'@'||'l_dblink;
execute immediate v_sql into s_sql;
dbms_output.put_line(s_sql);
end if;
end loop;
end;
/
I'm expecting it to loop through the table 'my_table'. put together 'SCHEMA.TABLE_NAME' and give me a row count.
oracle plsql
I'm calling a db link with some PL/SQL and I'm having issues with commas and pipes. I've tried multiple combinations but keep getting syntax errors.
I've tried multiple commas all over the place, to no avail :-(
declare
v_sql varchar2(4000);
s_sql varchar2(4000);
l_dblink varchar2(100) := 'DB1';
begin
for c in (select * from my_table)
loop
if
c.blue_table is not null
then v_sql :=
'select count(*) from' ||c.schema||'.'||c.table||'@'||'l_dblink;
execute immediate v_sql into s_sql;
dbms_output.put_line(s_sql);
end if;
end loop;
end;
/
I'm expecting it to loop through the table 'my_table'. put together 'SCHEMA.TABLE_NAME' and give me a row count.
oracle plsql
oracle plsql
edited Mar 26 at 6:32
Barbaros Özhan
19.1k7 gold badges16 silver badges35 bronze badges
19.1k7 gold badges16 silver badges35 bronze badges
asked Mar 26 at 5:38
Scouse_BobScouse_Bob
1327 bronze badges
1327 bronze badges
Some bell end has voted this down - why?
– Scouse_Bob
Mar 26 at 5:58
1
Not sure abt the downvote, but you seem to have an extra'
after'@'||
– Kaushik Nayak
Mar 26 at 6:08
Maybe somebody downvoted because you didn't explain what the error message is or nor what line it occurs.
– GolezTrol
Mar 26 at 6:15
2
You're also missing a space in your string concat.from
and the schema name are stuck together.
– GolezTrol
Mar 26 at 6:16
Legend. Sorted!
– Scouse_Bob
Mar 26 at 6:27
add a comment |
Some bell end has voted this down - why?
– Scouse_Bob
Mar 26 at 5:58
1
Not sure abt the downvote, but you seem to have an extra'
after'@'||
– Kaushik Nayak
Mar 26 at 6:08
Maybe somebody downvoted because you didn't explain what the error message is or nor what line it occurs.
– GolezTrol
Mar 26 at 6:15
2
You're also missing a space in your string concat.from
and the schema name are stuck together.
– GolezTrol
Mar 26 at 6:16
Legend. Sorted!
– Scouse_Bob
Mar 26 at 6:27
Some bell end has voted this down - why?
– Scouse_Bob
Mar 26 at 5:58
Some bell end has voted this down - why?
– Scouse_Bob
Mar 26 at 5:58
1
1
Not sure abt the downvote, but you seem to have an extra
'
after '@'||
– Kaushik Nayak
Mar 26 at 6:08
Not sure abt the downvote, but you seem to have an extra
'
after '@'||
– Kaushik Nayak
Mar 26 at 6:08
Maybe somebody downvoted because you didn't explain what the error message is or nor what line it occurs.
– GolezTrol
Mar 26 at 6:15
Maybe somebody downvoted because you didn't explain what the error message is or nor what line it occurs.
– GolezTrol
Mar 26 at 6:15
2
2
You're also missing a space in your string concat.
from
and the schema name are stuck together.– GolezTrol
Mar 26 at 6:16
You're also missing a space in your string concat.
from
and the schema name are stuck together.– GolezTrol
Mar 26 at 6:16
Legend. Sorted!
– Scouse_Bob
Mar 26 at 6:27
Legend. Sorted!
– Scouse_Bob
Mar 26 at 6:27
add a comment |
2 Answers
2
active
oldest
votes
You have some minor syntax issues
declare
v_sql varchar2(4000);
s_sql pls_integer; -- better to use a numeric type variable for returning result of "count"
l_dblink varchar2(100) := 'DB1';
begin
for c in (select * from my_table) loop
if c.blue_table is not null then
v_sql := 'select count(*) from ' || c.schema || '.' || c.table || '@' ||l_dblink;
--^ "space needed" [^ quote is removed ]
execute immediate v_sql into s_sql;
dbms_output.put_line(s_sql);
end if;
end loop;
end;
add a comment |
I changed this around a bit and realised it still wasn't working, with help from these guys here I sorted it out. Thanks.
declare
v_sql varchar2(4000);
s_sql varchar2(4000);
l_dblink varchar2(100) := 'DB1';
begin
for c in (select * from my_table)
loop
if
c.blue_table is not null
then
execute immediate' select count(*) from '||c.schema||'.'||c.table|| '@' ||l_dblink into s_sql;
dbms_output.put_line(s_sql);
end if;
end loop;
end;
/
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55350488%2fassistance-needed-for-a-syntax-error-with-my-simple-pl-sql%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
You have some minor syntax issues
declare
v_sql varchar2(4000);
s_sql pls_integer; -- better to use a numeric type variable for returning result of "count"
l_dblink varchar2(100) := 'DB1';
begin
for c in (select * from my_table) loop
if c.blue_table is not null then
v_sql := 'select count(*) from ' || c.schema || '.' || c.table || '@' ||l_dblink;
--^ "space needed" [^ quote is removed ]
execute immediate v_sql into s_sql;
dbms_output.put_line(s_sql);
end if;
end loop;
end;
add a comment |
You have some minor syntax issues
declare
v_sql varchar2(4000);
s_sql pls_integer; -- better to use a numeric type variable for returning result of "count"
l_dblink varchar2(100) := 'DB1';
begin
for c in (select * from my_table) loop
if c.blue_table is not null then
v_sql := 'select count(*) from ' || c.schema || '.' || c.table || '@' ||l_dblink;
--^ "space needed" [^ quote is removed ]
execute immediate v_sql into s_sql;
dbms_output.put_line(s_sql);
end if;
end loop;
end;
add a comment |
You have some minor syntax issues
declare
v_sql varchar2(4000);
s_sql pls_integer; -- better to use a numeric type variable for returning result of "count"
l_dblink varchar2(100) := 'DB1';
begin
for c in (select * from my_table) loop
if c.blue_table is not null then
v_sql := 'select count(*) from ' || c.schema || '.' || c.table || '@' ||l_dblink;
--^ "space needed" [^ quote is removed ]
execute immediate v_sql into s_sql;
dbms_output.put_line(s_sql);
end if;
end loop;
end;
You have some minor syntax issues
declare
v_sql varchar2(4000);
s_sql pls_integer; -- better to use a numeric type variable for returning result of "count"
l_dblink varchar2(100) := 'DB1';
begin
for c in (select * from my_table) loop
if c.blue_table is not null then
v_sql := 'select count(*) from ' || c.schema || '.' || c.table || '@' ||l_dblink;
--^ "space needed" [^ quote is removed ]
execute immediate v_sql into s_sql;
dbms_output.put_line(s_sql);
end if;
end loop;
end;
answered Mar 26 at 6:31
Barbaros ÖzhanBarbaros Özhan
19.1k7 gold badges16 silver badges35 bronze badges
19.1k7 gold badges16 silver badges35 bronze badges
add a comment |
add a comment |
I changed this around a bit and realised it still wasn't working, with help from these guys here I sorted it out. Thanks.
declare
v_sql varchar2(4000);
s_sql varchar2(4000);
l_dblink varchar2(100) := 'DB1';
begin
for c in (select * from my_table)
loop
if
c.blue_table is not null
then
execute immediate' select count(*) from '||c.schema||'.'||c.table|| '@' ||l_dblink into s_sql;
dbms_output.put_line(s_sql);
end if;
end loop;
end;
/
add a comment |
I changed this around a bit and realised it still wasn't working, with help from these guys here I sorted it out. Thanks.
declare
v_sql varchar2(4000);
s_sql varchar2(4000);
l_dblink varchar2(100) := 'DB1';
begin
for c in (select * from my_table)
loop
if
c.blue_table is not null
then
execute immediate' select count(*) from '||c.schema||'.'||c.table|| '@' ||l_dblink into s_sql;
dbms_output.put_line(s_sql);
end if;
end loop;
end;
/
add a comment |
I changed this around a bit and realised it still wasn't working, with help from these guys here I sorted it out. Thanks.
declare
v_sql varchar2(4000);
s_sql varchar2(4000);
l_dblink varchar2(100) := 'DB1';
begin
for c in (select * from my_table)
loop
if
c.blue_table is not null
then
execute immediate' select count(*) from '||c.schema||'.'||c.table|| '@' ||l_dblink into s_sql;
dbms_output.put_line(s_sql);
end if;
end loop;
end;
/
I changed this around a bit and realised it still wasn't working, with help from these guys here I sorted it out. Thanks.
declare
v_sql varchar2(4000);
s_sql varchar2(4000);
l_dblink varchar2(100) := 'DB1';
begin
for c in (select * from my_table)
loop
if
c.blue_table is not null
then
execute immediate' select count(*) from '||c.schema||'.'||c.table|| '@' ||l_dblink into s_sql;
dbms_output.put_line(s_sql);
end if;
end loop;
end;
/
answered Mar 26 at 6:35
Scouse_BobScouse_Bob
1327 bronze badges
1327 bronze badges
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55350488%2fassistance-needed-for-a-syntax-error-with-my-simple-pl-sql%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Some bell end has voted this down - why?
– Scouse_Bob
Mar 26 at 5:58
1
Not sure abt the downvote, but you seem to have an extra
'
after'@'||
– Kaushik Nayak
Mar 26 at 6:08
Maybe somebody downvoted because you didn't explain what the error message is or nor what line it occurs.
– GolezTrol
Mar 26 at 6:15
2
You're also missing a space in your string concat.
from
and the schema name are stuck together.– GolezTrol
Mar 26 at 6:16
Legend. Sorted!
– Scouse_Bob
Mar 26 at 6:27