Execute A SQL Query and Assign Output - OutSystems
Execute A SQL Query and Assign Output - OutSystems
Rank:
Ajithkumar Radhakrishnan 555 20
#823
Hi All,
Now after executuing this i want to return the spacedetails value assigned in
it. How can I do that?
0 0 on 2019-03-30
https://www.outsystems.com/forums/discussion/46624/execute-a-sql-query-and-assign-output/ 1/11
22/05/2021 Execute a SQL query and assign output | OutSystems
Hi Ajithkumar Radhakrishnan,
You are almost done . Just add a select statement at the end of you
query:
Select spacedetails ;
0 0 on 2019-03-30
Reply
Rank:
Ajithkumar Radhakrishnan #823
Hi Ajithkumar Radhakrishnan,
You are almost done . Just add a select statement at the end
of you query:
Select spacedetails ;
0 0 on 2019-03-30
Reply
Ajithkumar Radhakrishnan, Please find the sample screen shot in the Follow Post
attachment .
https://www.outsystems.com/forums/discussion/46624/execute-a-sql-query-and-assign-output/ 2/11
22/05/2021 Execute a SQL query and assign output | OutSystems
Create a structure with 1 attribute of type text and use the same
structure in the AdvSql output
Collapse
threads
1.png
Want threaded
replies to
always default
0 0 on 2019-03-30 to collapsed?
Reply Change this
view in the
forum settings.
1 reply Hide thread
Forum
Rank: Settings
Ajithkumar Radhakrishnan #823
https://www.outsystems.com/forums/discussion/46624/execute-a-sql-query-and-assign-output/ 3/11
22/05/2021 Execute a SQL query and assign output | OutSystems
0 0 on 2019-03-30
Reply
ok try creating an input parameter and use that .Please see the sample
screen shot.
11.png
0 0 on 2019-03-30
Reply
Rank:
Ajithkumar Radhakrishnan #823
No it doesnt help
0 0 on 2019-03-30
Reply
May be your query is having some error. Have you tested the query ??
https://www.outsystems.com/forums/discussion/46624/execute-a-sql-query-and-assign-output/ 4/11
22/05/2021 Execute a SQL query and assign output | OutSystems
0 0 on 2019-03-30
Reply
Rank:
Ajithkumar Radhakrishnan #823
0 0 on 2019-03-30
Reply
0 0 on 2019-03-30
Reply
Hi Ajithkumar Radhakrishnan,
Looks like some issue with query, if you can paste that query rather
than taking screenshot. It helps us to provide you the solution.
https://www.outsystems.com/forums/discussion/46624/execute-a-sql-query-and-assign-output/ 5/11
22/05/2021 Execute a SQL query and assign output | OutSystems
0 0 on 2019-03-31
Reply
Rank:
Ajithkumar Radhakrishnan #823
Hi Ajithkumar Radhakrishnan,
Looks like some issue with query, if you can paste that query
rather than taking screenshot. It helps us to provide you the
solution.
Attached the query below I have executed the query it fine and
working
0 0 on 2019-03-31
Reply
Rank:
Eduardo Jauch
MVP #6
Hi Ajithkumar.
Cheers.
0 0 on 2019-03-31
Reply
https://www.outsystems.com/forums/discussion/46624/execute-a-sql-query-and-assign-output/ 6/11
22/05/2021 Execute a SQL query and assign output | OutSystems
Rank:
Ajithkumar Radhakrishnan #823
Hi Ajithkumar.
Cheers.
/* %LogicalDatabase%=GetLogicalDatabase({OS_DUAL}) */
declare spacedetails VARCHAR(300);
cursor l_spaces
is
select df.tablespace_name nam,
totalusedspace Used,
(df.totalspace - tu.totalusedspace) free,
df.totalspace Total,
round(100 * ( (df.totalspace - tu.totaluseds
pace)/ df.totalspace)) persfree
from
(select tablespace_name,
round(sum(bytes) / 1048576) TotalSpac
e
from dba_data_files
group by tablespace_name) df,
(select round(sum(bytes)/(1024*1024)) tot
alusedspace, tablespace_name
from dba_segments
group by tablespace_name) tu
where df.tablespace_name = tu.tablespace_
name ;
r_spaces l_spaces%rowtype;
BEGIN
-- TODO: Implementation required for procedure MO
NITOR.checkspaces
loop
--dbms_output.put_line('Inside loop');
if spacedetails is null
then
spacedetails := r_spaces.nam||'-'||r_
spaces.free;
--dbms_output.put_line('Data ' || sp
acedetails);
else
spacedetails := spacedetails||','||r_
spaces.nam||'-'||r_spaces.free;
--dbms_output.put_line('Data ' || sp
acedetails);
end if;
end loop;
--dbms_output.put_line('END ' || spacedetails);
end;
0 0 on 2019-03-31
Reply
Rank:
Jorge Martins
MVP #19
Hi Ajithkumar,
Are you trying to run this code from within the SQL tool? You may find
this post an interesting read.
0 0 on 2019-03-31
Reply
Rank:
Ajithkumar Radhakrishnan #823
https://www.outsystems.com/forums/discussion/46624/execute-a-sql-query-and-assign-output/ 8/11
22/05/2021 Execute a SQL query and assign output | OutSystems
Hi Ajithkumar,
Are you trying to run this code from within the SQL tool? You
may find this post an interesting read.
0 0 on 2019-04-01
Reply
Rank:
Ajithkumar Radhakrishnan
#823
Hi Ajithkumar,
Are you trying to run this code from within the SQL tool? You
may find this post an interesting read.
I'm not calling any stored procedure. I have written a sql snippet
it has an output and has to be returned.
0 0 on 2019-04-01
Reply
Rank:
Eduardo Jauch
#6
MVP
Hello Ajithkumar,
https://www.outsystems.com/forums/discussion/46624/execute-a-sql-query-and-assign-output/ 9/11
22/05/2021 Execute a SQL query and assign output | OutSystems
Cheers.
0 0 on 2019-04-01
Reply
The next block in your flow could be an aggregate that will select the
records from the Entity SpaceDetails
0 0 on 2019-04-01
Reply
e.g.
myInsertStatement += '('||spacedetails||','||r_spaces.nam||'-
'||r_spaces.free||');
0 0 on 2019-04-01
Reply
Rank:
Eduardo Jauch
MVP #6
Hi Ajithkumar,
And between the suggestions given to you to you to return the result
of your SQL snippet, like do a SELECT or INSERT into an entity, there is
https://www.outsystems.com/forums/discussion/46624/execute-a-sql-query-and-assign-output/ 10/11
22/05/2021 Execute a SQL query and assign output | OutSystems
0 0 on 2019-04-01
Reply
55 Thomson Place
2nd Floor
Boston, MA 02210
Tel: +1 617 837 6840
Legal
Terms and conditions
Cookie Policy
https://www.outsystems.com/forums/discussion/46624/execute-a-sql-query-and-assign-output/ 11/11