Selecting with PL/SQL
Hi everyone,
I have a table with the following info
ClientName | PromoCode | ... with few more additional columns
John........... AAA
Brian...........AAC
Chung......... AAA
Mery........... AAA
Kyle ...........AAC
Peter...........AAB
and so on.
Now I need to select the count of each distinct PromoCode that has been used. In this case I want the output to be
TotalAAA | TotalAAC | TotalAAB
3 ............. 2 ............. 1
Please let me know if you need more info. I really appreciate for your help.
Thank you.
Warren probably meant, something like:
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - 64bit Production
With the Partitioning, OLAP and Data Mining options
SQL> with t as(
2 select 'John' ClientName, 'AAA' PromoCode from dual union all
3 select 'Brian', 'AAC' from dual union all
4 select 'Chung', 'AAA' from dual union all
5 select 'Mery', 'AAA' from dual union all
6 select 'Kyle ', 'AAC' from dual union all
7 select 'Peter', 'AAB' from dual )
8 --
9 select max(decode(promocode,'AAA', count(clientname),null)) TotalAAA,
10 max(decode(promocode,'AAB', count(clientname),null)) TotalAAB,
11 max(decode(promocode,'AAC', count(clientname),null)) TotalAAC
12 from t
13 group by promocode;
TOTALAAA TOTALAAB TOTALAAC
3 1 2
SQL> But the number of promocodes increases, the number of decode statements increases and hardcoding them.
Similar Messages
-
SEQUENCE Select within an SQL Query with an ORDER BY statement
Does anyone know why you cannot use an ORDER BY statement within an SQL query when also selecting from a SEQUENCE? My query was selecting production data as a result of a filtered search. I want to take the results of the filtered search and create a transaction. I have a sequence for generating transaction numbers where I select NEXTVAL. Since I could possibly obtain multiple, yet distinct, rows based upon my search criteria, I wanted to use an ORDER BY statement to simplify and order the resulting row(s).
I was able to get the SQL select with SEQUENCE.NEXTVAL to work without the ORDER BY, so I know that my SQL is correct. Thanks in-advance.Okay,
I understand. You want the sequence assigned first and the you want to ORDER BY. You
can do this using pipelined functions. See here:
CREATE OR REPLACE TYPE emp_rec_seq AS OBJECT (
seq NUMBER,
ename VARCHAR2 (20),
job VARCHAR2 (20),
sal NUMBER
CREATE OR REPLACE TYPE emp_tab_seq AS TABLE OF emp_rec_seq;
CREATE OR REPLACE FUNCTION get_emp_with_sequence
RETURN emp_tab_seq PIPELINED
IS
my_record emp_rec_seq := emp_rec_seq (NULL, NULL, NULL, NULL);
BEGIN
FOR c IN (SELECT dummy.NEXTVAL seq, ename, job, sal
FROM emp)
LOOP
my_record.seq := c.seq;
my_record.ename := c.ename;
my_record.job := c.job;
my_record.sal := c.sal;
PIPE ROW (my_record);
END LOOP;
RETURN;
END get_emp_with_sequence;after that, you can do a select like this:
SELECT seq, ename, job, sal
FROM TABLE (get_emp_with_sequence)
order by enamewhich will get you this:
SEQ ENAME JOB SAL
1053 BLAKE MANAGER 2850
1054 CLARK MANAGER 2450
1057 FORD ANALYST 3000
1062 JAMES CLERK 950
1055 JONES MANAGER 2975
1052 KING MANAGER 20000
1060 MARTIN SALESMAN 1250
1063 MILLER CLERK 1300
1064 DKUBICEK MANAGER 12000
1056 SCOTT ANALYST 3000
1058 SMITH CLERK 800
1061 TURNER SALESMAN 1500
1059 WARD SALESMAN 1250Denes Kubicek
http://deneskubicek.blogspot.com/
http://htmldb.oracle.com/pls/otn/f?p=31517:1
------------------------------------------------------------------- -
SELECT on TIMESTAMP field from ABAP with EXEC SQL
Hello,
I'm trying to get a field of one table which is defined as TIMESTAMP. MaxDB parameter DATE_TIME_FORMAT is set to INTERNAL. When I do the SELECT in SQL Studio I get ISO format 'YYYY-MM-DD HH:MM:SS.MMMMMM' back. So I tried a SELECT with ISO in WHERE clause, but I'm always getting a shortdump with this error:
Database error text........: "POS(82) Invalid date input value"
Database error code........: "-3065"
Then I did a SELECT without a WHERE clause in ABAP and got value '06-FEB-09' back from this field. So I tried with this ABAP statement and got no shortdump, but I also need to add time and not only the date.
EXEC SQL.
SELECT recv_time INTO :l_time FROM ztest WHERE sent_recv_time = '06-FEB-09'
ENDEXEC.
I'm using Native SQL because the SELECT is on a table which is not located in SAP Schema User. "SELECT recv_time FROM ztest WHERE recv_time = '2009-02-24 10:02:55.888000'" works in SQL studio, but not from ABAP.
Does anyone know which format I need to specify in the WHERE clause?
Regards
Markus Karsch
Edited by: Markus Karsch on Feb 26, 2009 4:22 PM>
Thomas Theodor Koetter wrote:
> Hello Markus
>
> I don't know whether this will work from ABAP, but at least MaxDB can internally handle the ODBC literals for time, date and timestamp.
>
> Therefore literals like
>
> "{d'0001-02-03'}"
> "{t'01:02:03'}"
> "{ts'0001-02-03 04:05:06'}"
>
> might work. See [http://msdn.microsoft.com/de-de/library/ms190234(SQL.90).aspx]
>
>
> HTH & regards Thomas
Hi Thomas,
Thanks for your help. Unfortunately doesn't seem to work, I get following shortdumps (tried with 3 different notations):
Database error text........: " "
Database error code........: "-4005"
Triggering SQL statement...: "SELECT xxxxxx, status, sent_xxxx_time FROM
xxx_xxxxxxxxx WHERE sent_recv_time = "{ts'2009-02-06 04:05:06'}""
Database error text........: "POS(87) Invalid keyword or missing delimiter"
Database error code........: "-3008"
Triggering SQL statement...: "SELECT xxxxxx, status, sent_xxxx_time FROM
xxx_xxxxxxxxx WHERE sent_recv_time = '{ts' 2009-02-06 04:05:06 '}'"
Database error text........: "POS(81) Missing value specification"
Database error code........: "-5010"
Triggering SQL statement...: "SELECT xxxxxx, status, sent_xxxx_time FROM
xxx_xxxxxxxxx WHERE sent_recv_time = { ts '2009-02-06 04:05:06.000' }"
Regards
Markus -
What is the sql command for SELECT with OR condition
Hi
What is the correct sql command for doing select with or condition??
SELECT * from TempData
WHERE port = '123'
OR serialnumber = '555'
So if there is a port = 123 or if there is a serialnumber = 555, I will get a successful select.
Thanks for helping a newbie!!Hi
What is the correct sql command for doing select with
or condition??
SELECT * from TempData
WHERE port = '123'
OR serialnumber = '555'
So if there is a port = 123 or if there is a
serialnumber = 555, I will get a successful select.
Thanks for helping a newbie!!Make sure you bracket your OR conditions
eg
SELECT * from TempData
WHERE column = 'VALUE'
and port = '123'
OR serialnumber = '555'
is read as
SELECT * from TempData
WHERE (column = 'VALUE'
and port = '123' )
OR serialnumber = '555'
which is not the same as
SELECT * from TempData
WHERE column = 'VALUE'
and ( port = '123'
OR serialnumber = '555' ) -
XML Publisher Report with PL/SQL
Hi
Like to know how to develop the XML Publisher Report with PL/SQL, i did the following
1. created a pkg like as below
CREATE OR REPLACE PACKAGE BODY APPS.TEST_XMLTAG_PKG AS
PROCEDURE main (errbuf OUT VARCHAR2,
retcode OUT NUMBER
) IS
BEGIN
DECLARE
ctx DBMS_XMLGEN.ctxHandle;
xml CLOB;
BEGIN
ctx := dbms_xmlgen.newcontext('select * from scott.emp');
dbms_xmlgen.setrowtag(ctx, 'MY-ROW-START-HERE');
xml := dbms_xmlgen.getxml(ctx);
dbms_output.put_line(xml);
Fnd_file.put_line (fnd_file.LOG, XML);
END;
END;
END TEST_XMLTAG_PKG;
this pkg produces the output with xml tag in the view log.
I have registered the conc program & xml rtf but it does not produce the output in PDF, , I am not able to get the xml tag when i click the Diagnostics --> View XML.
can you please let me know the next steps involved.
Regards
YramI think the problem is because there is no begin and end tag. save the xml from the logfile and open with xml editor or IE.. then you will see the problem.
add Begin and end tag...then you should be fine.. i.e
fnd_file.put_line(fnd_file.output,'<EMP_DATA>'); -- begin Tag
tx := dbms_xmlgen.newcontext('select * from scott.emp');
dbms_xmlgen.setrowtag(ctx, 'MY-ROW-START-HERE');
xml := dbms_xmlgen.getxml(ctx);
dbms_output.put_line(xml);
Fnd_file.put_line (fnd_file.LOG, XML);
fnd_file.put_line(fnd_file.output,'</EMP_DATA>'); -- End Tag
Hope this helps..>Good Luck
Ravi -
How to get JDev 10.1.2/ADF working with MS SQL Server Identity Column
Hello JDevTeam & JDevelopers,
I want to use JDev/ADF with a MS SQL Server 2005 database that contains tables employing IDENTITY Columns.
Using JDev/ADF and DBSequence with an Oracle database employing before triggers/sequences accomplishes what I am trying to do except I want to accomplish the same thing using a MSSQL Server 2005 database. Unfortunately I cannot change the database.
I have been able to select records but I am unable to insert records (due to my lack of knowledge) when using MS/SQL Server Identity Columns with JDev/ADF.
The following are the steps taken thus far.
Step1: Create table named test in the 2005 MSSQL Server (see script below).
Step2: Register 3rd Party JDBC Driver with JDeveloper; Using use Tools/Manage Libraries. Create a new entry in User Libraries with the following;
Library Name = Ms2005Jdbc
Class Path = C:\dev\Ms2005Jdbc\sqljdbc_1.0\enu\sqljdbc.jar
(note: Latest TYPE 4 JDBC driver for Microsoft SQL Server 2005 - free at http://msdn.microsoft.com/data/ref/jdbc/)
Step3:Create New Database Connection;
Connection Name = testconn1
Type = Third Party JDBC Driver
Authentication Username = sa, Password = password, Check Deploy Password
Connection
Driver Class = com.microsoft.sqlserver.jdbc.SQLServerDriver
Library = Ms2005Jdbc
Classpath = C:\dev\Ms2005Jdbc\sqljdbc_1.0\enu
URL = jdbc:sqlserver://192.168.1.151:1433;instanceName=sqlexpress;databaseName=test
Test Connection = Success!
Step5: Create a new application workspace using Web Application default template
Step6: In Model project, Create new Business Components Diagram.
Step7: Create new Entity Object. Goto to connections/testconn1, open tables and drag table test onto the diagram.
Step8: Generate Default Data Model Components by right-clicking on Entity Object. Except all the defaults.
When I test the Appmodule I select the view object and can scroll through all the records without error. If I try to insert a record, I get JBO-27014: Attribute testid in test is required.
Going back to the EntityObject I deselect the Mandatory attribute and re-run the test. Now when I try to insert it accepts the value for testname but it does not update the PK testid like it would using an "JDev/ADF/DBSequence/Oracle database/before trigger/sequence" solution.
Going back to the EntityObject and selecting refresh on insert does not solve this problem either. Changing the URL connection string and adding "SelectMethod=cursor" did not help and changing the SQl Flavor to SQLServer produced errors in the Business Components Browser. I've tried overriding isAttributeChanged() and other things as well.
I am totally stuck! Can anyone provide a solution?
Thanks for you help,
BG...
Create table named test
use [testdb]
go
set ansi_nulls on
go
set quoted_identifier on
go
create table [test](
[testid] [int] identity(0,1) not null,
[testname] [nvarchar](50) collate sql_latin1_general_cp1_ci_as not null,
constraint [pk_test] primary key nonclustered
[testid] asc
)with (pad_index = off, ignore_dup_key = off) on [primary]
) on [primary]Figured it out!
When using the MS SQL Server 2000 Database with the MS JDBC 2000 Driver you specify the SQL Flavor to SQLServer. However setting the SQL Flavor to SQLServer with MS SQL Server 2005 Database and the MS JDBC 2005 Driver will *** fail ***.
When working with the MS SQL Server 2005 Database and the MS JDBC 2005 Driver you set the SQL Flavor to SQL92 and the Type Map to Java.
If using a named instance like I am you would specify the URL = jdbc:sqlserver://<db host ip address>:<listening port>;instanceName=<your instance name>;selectMethod=cursor;databaseName=<your database name> (note: leave out the < >)
The 2005 Driver Class is different then the 2000 and is specified as com.microsoft.sqlserver.jdbc.SQLServerDriver
Note: In a default MS SQL Server 2005 installation the listening port will change *** everytime *** the host is restarted! You can override this though.
For the primary key you need to deselect the Mandatory attribute in the EntityObject editor.
Set Refresh on insert/update = no.
Set Updateable = never.
Now my Primary Keys which get their values from the Identity Column are working with ADF in a predictable way.
Simple enough but I have been away from this stuff for awhile.
BG... -
Calculating values from row to row with pure sql?
Hello,
I'm searching for a way to calculate values from row to row with pure sql. I need to create an amortisation table. How should it work:
Known values at start: (they can be derived with an ordinary sql-statement)
- redemption amount RA
- number of payment terms NT
- annuity P (is constant in every month)
- interest rate IR
What has to be calculated:
First row:
RA1 = RA - P
Z1 = (RA1 * (IR/100/12))
T1 = P - Z1
2nd row
RA2 = RA1 - T1
Z2 = (RA2 * (IR/100/12))
T2 = P - Z2
and so on until NT has reached.
It should look like
NT
P
Tn
Zn
RAn
1
372,17
262,9
109,27
22224,83
2
372,17
264,19
107,98
21961,93
3
372,17
265,49
106,68
21697,74
4
372,17
266,8
105,38
21432,25
5
372,17
268,11
104,06
21165,45
6
372,17
269,43
102,75
20897,34
7
372,17
270,75
101,42
20627,91
8
372,17
272,09
100,09
20357,16
9
372,17
273,42
98,75
20085,07
10
372,17
274,77
97,41
19811,65
11
372,17
276,12
96,06
19536,88
12
372,17
277,48
94,7
19260,76
13
372,17
278,84
93,33
18983,28
14
372,17
280,21
91,96
18704,44
15
372,17
281,59
90,59
18424,23
16
372,17
282,97
89,2
18142,64
17
372,17
284,36
87,81
17859,67
18
372,17
285,76
86,41
17575,31
19
372,17
287,17
85,01
17289,55
20
372,17
288,58
83,59
17002,38
21
372,17
290
82,18
16713,8
22
372,17
291,42
80,75
16423,8
23
372,17
292,86
79,32
16132,38
24
372,17
294,3
77,88
15839,52
25
372,17
295,74
76,43
15545,22
26
372,17
297,2
74,98
15249,48
27
372,17
298,66
73,52
14952,28
28
372,17
300,13
72,05
14653,62
29
372,17
301,6
70,57
14353,49
30
372,17
303,09
69,09
14051,89
31
372,17
304,58
67,6
13748,8
32
372,17
306,07
66,1
13444,22
33
372,17
307,58
64,6
13138,15
34
372,17
309,09
63,08
12830,57
35
372,17
310,61
61,56
12521,48
36
372,17
312,14
60,04
12210,87
37
372,17
313,67
58,5
11898,73
38
372,17
315,21
56,96
11585,06
39
372,17
316,76
55,41
11269,85
40
372,17
318,32
53,85
10953,09
41
372,17
319,89
52,29
10634,77
42
372,17
321,46
50,71
10314,88
43
372,17
323,04
49,13
9993,42
44
372,17
324,63
47,55
9670,38
45
372,17
326,22
45,95
9345,75
46
372,17
327,83
44,35
9019,53
47
372,17
329,44
42,73
8691,7
48
372,17
331,06
41,11
8362,26
I would appreciate every help and idea to solve the problem solely with sql.
Thanks and regards
CarstenIt's using Model Clause and / or Recursive With (sometimes maybe both)
Regards
Etbin
with
rec_proc(nt,i,ra,p,ir,z,t) as
(select nt,i,ra - p,p,ir,round((ra - p) * 0.01 * ir / 12,2),p - round((ra - p) * 0.01 * ir / 12,2)
from (select 48 nt,22597 ra,372.17 p,5.9 ir,0 z,0 t,1 i
from dual
union all
select nt,i + 1,ra - t,p,ir,round((ra - t) * 0.01 * ir / 12,2),p - round((ra - t) * 0.01 * ir / 12,2)
from rec_proc
where i < nt
select * from rec_proc
try to adjust initial values and rounding please
NT
I
RA
P
IR
Z
T
48
1
22224.83
372.17
5.9
109.27
262.9
48
2
21961.93
372.17
5.9
107.98
264.19
48
3
21697.74
372.17
5.9
106.68
265.49
48
4
21432.25
372.17
5.9
105.38
266.79
48
5
21165.46
372.17
5.9
104.06
268.11
48
6
20897.35
372.17
5.9
102.75
269.42
48
7
20627.93
372.17
5.9
101.42
270.75
48
8
20357.18
372.17
5.9
100.09
272.08
48
9
20085.1
372.17
5.9
98.75
273.42
48
10
19811.68
372.17
5.9
97.41
274.76
48
11
19536.92
372.17
5.9
96.06
276.11
48
12
19260.81
372.17
5.9
94.7
277.47
48
13
18983.34
372.17
5.9
93.33
278.84
48
14
18704.5
372.17
5.9
91.96
280.21
48
15
18424.29
372.17
5.9
90.59
281.58
48
16
18142.71
372.17
5.9
89.2
282.97
48
17
17859.74
372.17
5.9
87.81
284.36
48
18
17575.38
372.17
5.9
86.41
285.76
48
19
17289.62
372.17
5.9
85.01
287.16
48
20
17002.46
372.17
5.9
83.6
288.57
48
21
16713.89
372.17
5.9
82.18
289.99
48
22
16423.9
372.17
5.9
80.75
291.42
48
23
16132.48
372.17
5.9
79.32
292.85
48
24
15839.63
372.17
5.9
77.88
294.29
48
25
15545.34
372.17
5.9
76.43
295.74
48
26
15249.6
372.17
5.9
74.98
297.19
48
27
14952.41
372.17
5.9
73.52
298.65
48
28
14653.76
372.17
5.9
72.05
300.12
48
29
14353.64
372.17
5.9
70.57
301.6
48
30 -
I need to host a website with a SQL database - Azure pricing details are too confusing
Hello,
I need to give a potential client a hosting price for a somewhat simple web application they want me to build. I told them it shouldn't be a problem. After gathering the requirements, I figured I would use the following technology to build and host
it:
ASP.NET 4.5
MVC 5
1 SQL Database ~ 25GB with options to expand and also with a backup
SSL certificate needed
Hosting would be on Azure because I have some experience using Visual Studio 2012 and integrating the Visual Studio Online (TFS) source code and scrum web applications. I've never actually spun up a website with a SQL database using Azure before, but I
imagined it wasn't too difficult to find a general hosting plan to support the above requirements.
The use of the website will be very simple and limited to the basic CRUD operations. Will support forms authentication using the Identity 2.0 framework. The web applications main purpose is to fill out a form for new accounts, have a search page for
those accounts, a page to view a created account and add notes to it. So performance wise, it isn't asking for much. I just want it to be fast and secure.
So I start looking on the Azure's pricing landing page which is here: (can't put links in here, but search Azure pricing on Bing) and I see this Pricing Calculator, so I click it
First thing I notice is the Websites tab doesn't mention SQL Database - in fact the Data Management is a separate tab from Websites. And if I made my selections on the Websites tab, the estimated monthly price doesn't stay the same when I go to the Data
Management tab - so I get the illusion I have to have two separate purchases.
I'm not exactly sure if the Pay as You Go billing feature would be okay because it's just a bit scary to leave every monthly payment up to chance; somewhat. Would love to know if there is other payment options that I could see for what I described above.
I want to use Azure to host my asp.net website - it makes sense and the integration with Visual Studio is amazing. I love the publish feature for both MVC 5 Projects and SQL Database Projects.
Thanks in advance for the help!Hello jdevanderson,
I suggest that you start by looking at the pricing TIERS for the Azure website. This link will give you clarity on different Service TIERS that are availaible:
http://azure.microsoft.com/en-in/pricing/details/websites/
You can guage your requirement and choose the Service TIER accordingly.
And regarding the database, you are right about it. You will be charged seperately for the database. You can refer to this link that will give you clarity on SQL database pricing:
http://azure.microsoft.com/en-in/pricing/details/sql-database/
Refer to this link for more information on 'How pricing works':
http://azure.microsoft.com/en-in/pricing/
Use the full calculator to add your website and the database to get an estimated cost:
http://azure.microsoft.com/en-in/pricing/calculator/?scenario=full
Thanks,
Syed Irfan Hussain -
Performance for join 9 custom table with native SQL ?
Hi Expert,
I need your opinion regarding performance to join 9 tables with native sql. Recently i have to tunning some customize extraction cost report. This report extract about 10 million cost of material everyday.
The current program actually, try to populate the condition data and insert into customize table and join all the table to get data using native sql.
SELECT /*+ ordered use_hash(mst,pg,rg,ps,rs,dpg,drg,dps,drs) */
mst.werks, ....................................
FROM
sapsr3.zab_info mst,
sapsr3.zab_pc pg,
sapsr3.zab_rc rg,
sapsr3.zab_pc ps,
sapsr3.zab_rc rs,
sapsr3.zab_g_pc dpg,
sapsr3.zab_g_rc drg,
sapsr3.zab_s_pc dps,
sapsr3.zab_s_rc drs
WHERE mst.zseq_no = :p_rep_run_id
AND mst.werks = :p_werks
AND mst.mandt = rg.mandt(+)
AND mst.ekorg = rg.ekorg(+)
AND mst.lifnr = rg.lifnr(+)
AND mst.matnr = rg.matnr(+)
............................................... unitl all table (9 tables)
AND ps.mandt = dps.mandt(+)
AND ps.knumh = dps.knumh(+)
AND ps.zseq_no = dps.zseq_no(+)
AND COALESCE (dps.kbetr, drs.kbetr, dpg.kbetr, drg.kbetr) <> 0
It seems the query ask for database to using hashed table. would that be it will burden the database ? and impacted to others sap process ?
Please advise
Thank You and Best Regardsyou can only argue coming from measurements and that is not the case.
Coming from the code, I see only that you do not understand it at all, so better leave it as it is. It is not a hash table, but a hash join on these table. -
I am having a parent program which fires the child process.
I want the parent program to wait until all the child program are completed.
for this i have written this code.
from the curosr c1 i am taking all the child processes.
Now when i am putting the exit condition(EXIT WHEN J = V_COUNT1) in the for loop then
everything is working fine and parent program completes only after all
the child processes are completed.
but when i am not putting this condition the parent program does not complete it remains in the loop
i dont understand why?
declare
cursor c1 is
SELECT fcr.request_id
FROM
fnd_concurrent_programs fcp,
fnd_concurrent_requests fcr
WHERE
fcp.concurrent_program_id = fcr.concurrent_program_id
AND fcp.concurrent_program_name LIKE 'WSHRDPIK' -- name of the pick slip report
AND fcr.request_id > (SELECT max(fcr.request_id)
FROM fnd_concurrent_requests fcr,
fnd_concurrent_programs fcp
WHERE fcp.concurrent_program_id = fcr.concurrent_program_id
AND fcp.concurrent_program_name LIKE 'OAI_PROCESS_SHIPMENTS')
AND phase_code NOT LIKE 'C'
AND requested_by IN (SELECT user_id
FROM fnd_user
WHERE user_name LIKE 'MAKANIV');
BEGIN
open c1;
FETCH c1 Bulk Collect into v_count;
close c1;
v_count1 := v_count.count;
for i in v_count.first..v_count.last loop
v_success := FND_CONCURRENT.GET_REQUEST_STATUS(v_count(i)
,NULL
,NULL
,v_phase
,v_status
,v_dev_phase
,v_dev_status
,v_message);
WHILE v_dev_phase != 'COMPLETE'
LOOP
v_success:= FND_CONCURRENT.WAIT_FOR_REQUEST(v_count(i)
,2
,10
,v_phase
,v_status
,v_dev_phase
,v_dev_status
,v_message);
EXIT WHEN v_dev_phase = 'COMPLETE';
END LOOP;
-- J:= J + 1;
-- EXIT WHEN J = V_COUNT1;
END loop;
END;Dear Salvatore,
Have you opened the CURSOR ??
Try the following :
=============================================
declare
cursor C1 (INPUT_VAR in number) is select column1 from table where column2 =INPUT_VAR ;
begin
for I in C1 (1111) Loop --- you can try any number
dbms_output.put_line(I.ID) ;
end loop;
end ;
=============================================
Bst Rgds ,
Franco Lin
I am new to this forum, and new to PL/SQL. I am writing my first larger project that will be in part implemented with PL/SQL. I have a simple cursor that sound like that:
CURSOR name
IS
SELECT column1
FROM table
WHERE column2 = PL/SQL-variable;
When I run this Function the SELECT returns nothing. When I make the same SELECT from SQL*PLUS I receive 1 row.
I have checked the variable via dbms_output.put_line, and make the mentioned SELECT with it.
Has anyone a solution for this?
Thanks in advance for any help.
Regards
Salvatore Cagliari
null -
Issue with Essbase - SQL Interface in UNIX box
Hi All,
One of our customer is facing an issue while trying to connect to the Oracle datasource from Essbase version 9.0.1.0.00 in a 64 bit UNIX box. He is using Oracle wired protocol for SQL interface.
Customer has tried the below and getting the below error:
1) Ran the nst-sql.sh file.
2) Edited the odbc.ini file and the .profile file with the required dsn information.
3) From the console selected the open SQL option and received the following error " There are no datasources defined. Please create one to continue"
I have attached the odbc.ini file and the .profile file for your reference.
Any help appreciated.
Thanks,
Bharathi Raja
ODBC.ini file
ARBORPATH=/hyper/arbor/Hyperion/AnalyticServices
HYPERION_HOME=/hyper/arbor/Hyperion
ESSLANG=English_UnitedStates.Latin1@Binary
SHLIB_PATH=.:/hyper/arbor/Hyperion/common/ODBC/Merant/5.0/lib:/hyper/arbor/Hyperion/AnalyticServices/bin:$SHLIB_PATH
PATH=$PATH:$ARBORPATH/bin:/usr/lib:$ARBORPATH:$HYPERION_HOME/common/ODBC/Merant/5.0/lib
LD_LIBRARY_PATH=$HYPERION_HOME/common/ODBC/Merant/5.0/lib
ulimit -c unlimited
ulimit -n 1024
LIBPATH=/hyper/arbor/Hyperion/common/ODBC/Merant/5.0/lib
LANG=en_US
ODBCINI=/hyper/arbor/Hyperion/Essbase/bin/.odbc.ini
[ODBC Data Sources]
DB2 Wire Protocol=DataDirect 5.0 DB2 Wire Protocol Driver
dBase=DataDirect 5.0 dBaseFile(*.dbf)
FoxPro3=DataDirect 5.0 dBaseFile(*.dbf)
Informix=DataDirect 5.0 Informix
Informix Wire Protocol=DataDirect 5.0 Informix Wire Protocol
Oracle=DataDirect 5.0 Oracle
Oracle Wire Protocol=DataDirect 5.0 Oracle Wire Protocol
Progress9=DataDirect 5.0 Progress SQL92
Progress10=DataDirect 5.0 Progress OpenEdge
SQLServer Wire Protocol=DataDirect 5.0 SQL Server Wire Protocol
Sybase Wire Protocol=DataDirect 5.0 Sybase Wire Protocol
Text=DataDirect 5.0 TextFile(*.*)
[DB2 Wire Protocol]
Driver=$HYPERION_HOME/common/ODBC/Merant/5.0/lib/ARdb220.sl
Description=DataDirect 5.0 DB2 Wire Protocol Driver
AddStringToCreateTable=
AlternateID=
Collection=OS/390 and AS/400 (leave blank for DB2 UDB)
Database=DB2 UDB (leave blank for OS/390 and AS/400)
DynamicSections=100
GrantAuthid=PUBLIC
GrantExecute=1
IpAddress=DB2 server host
IsolationLevel=CURSOR_STABILITY
Location=OS/390 and AS/400 (leave blank for DB2 UDB)
LogonID=UID
Password=PWD
Package=DB2 package name
PackageOwner=
TcpPort=DB2 server port
WithHold=1
[dBase]
Driver=$HYPERION_HOME/common/ODBC/Merant/5.0/lib/ARdbf20.sl
Description=DataDirect 5.0 dBaseFile(*.dbf)
ApplicationUsingThreads=1
CacheSize=4
CreateType=dBASE5
Database=$HYPERION_HOME/common/ODBC/Merant/5.0/demo
DataFileExtension=DBF
ExtensionCase=UPPER
FileOpenCache=0
IntlSort=0
LockCompatibility=dBASE
Locking=RECORD
UseLongNames=0
UseLongQualifiers=0
[FoxPro3]
Driver=$HYPERION_HOME/common/ODBC/Merant/5.0/lib/ARdbf20.sl
Description=DataDirect 5.0 dBaseFile(*.dbf)
ApplicationUsingThreads=1
CacheSize=4
CreateType=FoxPro30
Database=$HYPERION_HOME/common/ODBC/Merant/5.0/demo
DataFileExtension=DBF
ExtensionCase=UPPER
FileOpenCache=0
IntlSort=0
LockCompatibility=Fox
Locking=RECORD
UseLongNames=0
UseLongQualifiers=0
[Informix]
Driver=$HYPERION_HOME/common/ODBC/Merant/5.0/lib/ARinf20.sl
Description=DataDirect 5.0 Informix
ApplicationUsingThreads=1
CancelDetectInterval=0
CursorBehavior=0
Database=db
EnableInsertCursors=0
GetDBListFromInformix=1
HostName=Informix host
LogonID=UID
Password=PWD
Protocol=onsoctcp
ServerName=Informix server
Service=Informix service name
TrimBlankFromIndexName=1
[Informix Wire Protocol]
Driver=$HYPERION_HOME/common/ODBC/Merant/5.0/lib/ARifcl20.sl
Description=DataDirect 5.0 Informix Wire Protocol
ApplicationUsingThreads=1
CancelDetectInterval=0
Database=db
HostName=Informix host
LogonID=UIDUID
Password=PWDPWD
PortNumber=Informix server port
ServerName=Informix server
TrimBlankFromIndexName=1
[Oracle]
Driver=$HYPERION_HOME/common/ODBC/Merant/5.0/lib/ARor820.sl
Description=DataDirect 5.0 Oracle
ApplicationUsingThreads=1
ArraySize=60000
CatalogIncludesSynonyms=1
CatalogOptions=0
DefaultLongDataBuffLen=1024
DescribeAtPrepare=0
EnableDescribeParam=0
EnableNcharSupport=0
EnableScrollableCursors=1
EnableStaticCursorsForLongData=0
EnableTimestampWithTimeZone=0
LocalTimeZoneOffset=
LockTimeOut=-1
LogonID=UID
OptimizeLongPerformance=0
Password=PWD
ProcedureRetResults=0
ServerName=Oracle host
UseCurrentSchema=1
[Oracle Wire Protocol]
Driver=$HYPERION_HOME/common/ODBC/Merant/5.0/lib/ARora20.sl
Description=DataDirect 5.0 Oracle Wire Protocol
ApplicationUsingThreads=1
ArraySize=60000
CachedCursorLimit=32
CachedDescLimit=0
CatalogIncludesSynonyms=1
CatalogOptions=0
DefaultLongDataBuffLen=1024
DescribeAtPrepare=0
EnableDescribeParam=0
EnableNcharSupport=0
EnableScrollableCursors=1
EnableStaticCursorsForLongData=0
EnableTimestampWithTimeZone=0
HostName=Oracle server
LocalTimeZoneOffset=
LockTimeOut=-1
LogonID=UID
Password=PWD
PortNumber=1521
ProcedureRetResults=0
SID=Oracle SID
UseCurrentSchema=1
[Progress9]
Driver=$HYPERION_HOME/common/ODBC/Merant/5.0/lib/ARpro920.sl
Description=DataDirect 5.0 Progress SQL92
DatabaseName=db
HostName=Progress9 host
LogonID=UID
Password=PWD
PortNumber=Progress9 server port
[Progress10]
Driver=$HYPERION_HOME/common/ODBC/Merant/5.0/lib/ARpro1920.sl
Description=DataDirect 5.0 Progress OpenEdge
DatabaseName=db
HostName=Progress10 host
LogonID=UID
Password=PWD
PortNumber=Progress10 server port
[SQLServer Wire Protocol]
Driver=$HYPERION_HOME/common/ODBC/Merant/5.0/lib/ARmsss20.sl
Description=DataDirect 5.0 SQL Server Wire Protocol
Address=SQLServer host,SQLServer server port
AnsiNPW=Yes
Database=db
LogonID=UID
Password=PWD
QuotedId=No
[Sybase Wire Protocol]
Driver=$HYPERION_HOME/common/ODBC/Merant/5.0/lib/ARase20.sl
Description=DataDirect 5.0 Sybase Wire Protocol
ApplicationName=
ApplicationUsingThreads=1
ArraySize=50
Charset=
CursorCacheSize=1
Database=db
DefaultLongDataBuffLen=1024
EnableDescribeParam=0
EnableQuotedIdentifiers=0
InitializationString=
Language=
LogonID=UID
NetworkAddress=Sybase host,Sybase server port
OptimizePrepare=1
PacketSize=0
Password=PWD
RaiseErrorPositionBehavior=0
SelectMethod=0
WorkStationID=
[Text]
Driver=$HYPERION_HOME/common/ODBC/Merant/5.0/lib/ARtxt20.sl
Description=DataDirect 5.0 TextFile(*.*)
AllowUpdateAndDelete=0
ApplicationUsingThreads=1
CacheSize=4
CenturyBoundary=20
Database=$HYPERION_HOME/common/ODBC/Merant/5.0/demo
DataFileExtension=TXT
DecimalSymbol=.
Delimiter=
FileOpenCache=0
FirstLineNames=0
IntlSort=0
ScanRows=25
TableType=Comma
UndefinedTable=GUESS
[ODBC]
IANAAppCodePage=4
InstallDir=$HYPERION_HOME/common/ODBC/Merant/5.0
Trace=0
TraceDll=$HYPERION_HOME/common/ODBC/Merant/5.0/lib/odbctrac.sl
TraceFile=odbctrace.out
UseCursorLib=0
*.Profile file*
HYPERION_HOME=/hyper/arbor/Hyperion
ESSLANG=English_UnitedStates.Latin1@Binary
SHLIB_PATH=.:/hyper/arbor/Hyperion/common/ODBC/Merant/5.0/lib:/hyper/arbor/Hyperion/AnalyticServices/bin:$SHLIB_PATH
PATH=$PATH:$ARBORPATH/bin:/usr/lib:$ARBORPATH:$HYPERION_HOME/common/ODBC/Merant/5.0/lib
LD_LIBRARY_PATH=$HYPERION_HOME/common/ODBC/Merant/5.0/lib
ulimit -c unlimited
ulimit -n 1024
LIBPATH=/hyper/arbor/Hyperion/common/ODBC/Merant/5.0/lib
LANG=en_US
ODBCINI=/hyper/arbor/Hyperion/Essbase/bin/.odbc.iniThe essbase user needs to be restarted to be able to see the new odbc.ini entries.
After editing the files you mentioned, did you restart the essbase services?
At the very least, did you exit EAS, then restart EAS? (I don't remember which one of these will do it.) If your entries are correct, then one of these should get the essbase user to 'see' the odbc connection.
Also, it might help to remove extraneous entries in the .odbc.ini file, kind of difficult to read thru all of that.
Robert
Edited by: RobertR3 on Mar 17, 2009 10:19 AM -
Create a report with PL/SQL
Hi,
I have two pages: the first page contains two text fields and a submit button. In the first text field you can enter a name and in the second field you can enter a number. That means you can search a record by name or by number.
In the second page the report is generated depending on the used text field of the first page.
I tried to to define a region source code with PL/SQL for the report, but nothing appears on the report page although the record I was looking for exists in the database.
begin
if :ENTERNAME IS NOT NULL then
FOR item IN (select "TB_PERSON_INSTITUTION"."PI_ID" as "PI_ID",
"TB_PERSON_INSTITUTION"."PI_NAME" as "PI_NAME",
"TB_PERSON_INSTITUTION"."PI_VORNAME" as "PI_VORNAME",
from "TB_PERSON_INSTITUTION" "TB_PERSON_INSTITUTION"
where upper("TB_PERSON_INSTITUTION"."PI_NAME") like upper(:ENTERNAME||'%'))
loop
DBMS_OUTPUT.PUT_LINE('First name = ' || item.PI_NAME ||
', Last name = ' || item.PI_VORNAME);
end loop;
end if;
end;
Regards
MarkHi,
ok thanks. I tried to use the SQL-Report with type "SQL Query (PL/SQL function body returning SQL-Query)" and made a few changes in the SQL-Statement so that a second table is also included:
declare My_select varchar2(500);
begin
if :TEXTEINGABENAME IS NOT NULL then
My_select:='SELECT
"TB_ADRESSE"."A_PLZ" "A_PLZ",
"TB_ADRESSE"."A_ORT" "A_ORT",
"TB_ADRESSE"."A_ID" "A_ID",
"TB_PERSON_INSTITUTION"."PI_MITGLIEDSNUMMER" "PI_MITGLIEDSNUMMER",
"TB_PERSON_INSTITUTION"."PI_NAME" "PI_NAME",
"TB_PERSON_INSTITUTION"."PI_VORNAME" "PI_VORNAME",
"TB_PERSON_INSTITUTION"."PI_ERGAENZUNG" "PI_ERGAENZUNG",
"TB_PERSON_INSTITUTION"."PI_ERGAENZUNG1" "PI_ERGAENZUNG1",
"TB_PERSON_INSTITUTION"."PI_ID" "PI_ID"
FROM
"TB_ADRESSE" "TB_ADRESSE",
"TB_PERSON_INSTITUTION" "TB_PERSON_INSTITUTION"
WHERE "TB_PERSON_INSTITUTION"."PI_ID" = "TB_ADRESSE"."A_F_PERSON_INSTITUTION"
AND upper("TB_PERSON_INSTITUTION"."PI_NAME") like upper(:TEXTEINGABENAME||"%")';
else
if :TEXTMITGLIEDSNUMMER is not null then
My_select:='SELECT
"TB_ADRESSE"."A_PLZ" "A_PLZ",
"TB_ADRESSE"."A_ORT" "A_ORT",
"TB_ADRESSE"."A_ID" "A_ID",
"TB_PERSON_INSTITUTION"."PI_MITGLIEDSNUMMER" "PI_MITGLIEDSNUMMER",
"TB_PERSON_INSTITUTION"."PI_NAME" "PI_NAME",
"TB_PERSON_INSTITUTION"."PI_VORNAME" "PI_VORNAME",
"TB_PERSON_INSTITUTION"."PI_ERGAENZUNG" "PI_ERGAENZUNG",
"TB_PERSON_INSTITUTION"."PI_ERGAENZUNG1" "PI_ERGAENZUNG1",
"TB_PERSON_INSTITUTION"."PI_ID" "PI_ID"
FROM
"TB_ADRESSE" "TB_ADRESSE",
"TB_PERSON_INSTITUTION" "TB_PERSON_INSTITUTION"
WHERE "TB_PERSON_INSTITUTION"."PI_ID" = "TB_ADRESSE"."A_F_PERSON_INSTITUTION"
AND upper("TB_PERSON_INSTITUTION"."PI_MITGLIEDSNUMMER") like upper(:TEXTMITGLIEDSNUMMER||"%")';
end if;
end if;
return My_select;
end;
When I try to apply changes an error message occurs:
"Query cannot be parsed within the Builder. If you believe your query is syntactically correct, check the ''generic columns'' checkbox below the region source to proceed without parsing. The query can not be parsed, the cursor is not yet open or a function returning a SQL query returned without a value."
Regards,
Mark -
Radio button on a from generated with PL/SQL procedure
Hi,
I have a form generated with PL/SQL procedure. This procedure calls another procedure on 'Submit'. If I select value for the radio button, it works fine. But if no value is given to the radio button on the form, it gives error. Is the radio button mandatory field by nature? or do I need to give default value some how? How do I make the radio button optional? so that I can call the next procedure without passing the param.
Create or Replace PROCEDURE OBM_PROCEDURE
htp.formOpen(OWA_UTIL.GET_OWA_SERVICE_PATH || 'process_obm');
htp.Print('Admin ');
htp.FormRadio('p_access_level','A');
htp.Print('Doc ');
htp.FormRadio('p_access_level','D');
htp.formSubmit(cname=>'p_button', cvalue=> 'Submit');
=================================================================
Create or Replace PROCEDURE PROCESS_OBM
(p_access_level VARCHAR2,
p_button VARCHAR2)
htp.Print('p_access_level ');
Thanks!Hi
The parameters of the called procedure should have defualt values like this
create or Replace PROCEDURE PROCESS_OBM
(p_access_level VARCHAR2 default 1,
p_button VARCHAR2 default null
htp.Print('p_access_level ');
Thanks,
sharmila -
What's wrong with this SQL?
what's wrong with this SQL?
Posted: Jan 16, 2007 9:35 AM Reply
Hi, everyone:
when I insert into table, i use the fellowing SQL:
INSERT INTO xhealthcall_script_data
(XHC_CALL_ENDED, XHC_SWITCH_PORT, XHC_SCRIPT_ID, XHC_FAX_SPECIFIED)
VALUES (SELECT TO_DATE(HH_END_DATE||' '||HH_END_TIME,'MM/DD/YY HH24:MI:SS'), HH_SWITCHPORT, HH_SCRIPT,'N'
FROM tmp_healthhit_load WHERE HH_SCRIPT !='BROCHURE' UNION
SELECT TO_DATE(HH_END_DATE||' '||HH_END_TIME,'MM/DD/YY HH24:MI:SS'), HH_SWITCHPORT, HH_SCRIPT,'N' FROM tmp_healthhit_load WHERE HH_SCRIPT !='BROCHURE');
I always got an error like;
VALUES (SELECT TO_DATE(HH_END_DATE||' '||HH_END_TIME,'MM/DD/YY HH24:MI:SS'), HH_SWITCHPORT,
ERROR at line 3:
ORA-00936: missing expression
but I can't find anything wrong, who can tell me why?
thank you so much in advance
mpowel01
Posts: 1,516
Registered: 12/7/98
Re: what's wrong with this SQL?
Posted: Jan 16, 2007 9:38 AM in response to: jerrygreat Reply
For starters, an insert select does not have a values clause.
HTH -- Mark D Powell --
PP
Posts: 41
From: q
Registered: 8/10/06
Re: what's wrong with this SQL?
Posted: Jan 16, 2007 9:48 AM in response to: mpowel01 Reply
Even I see "missing VALUES" as the only error
Eric H
Posts: 2,822
Registered: 10/15/98
Re: what's wrong with this SQL?
Posted: Jan 16, 2007 9:54 AM in response to: jerrygreat Reply
...and why are you doing a UNION on the exact same two queries?
(SELECT TO_DATE(HH_END_DATE||' '||HH_END_TIME,'MM/DD/YY HH24:MI:SS') ,HH_SWITCHPORT ,HH_SCRIPT ,'N' FROM tmp_healthhit_load WHERE HH_SCRIPT !='BROCHURE' UNION SELECT TO_DATE(HH_END_DATE||' '||HH_END_TIME,'MM/DD/YY HH24:MI:SS') ,HH_SWITCHPORT ,HH_SCRIPT ,'N' FROM tmp_healthhit_load WHERE HH_SCRIPT !='BROCHURE');
jerrygreat
Posts: 8
Registered: 1/3/07
Re: what's wrong with this SQL?
Posted: Jan 16, 2007 9:55 AM in response to: mpowel01 Reply
Hi,
thank you for your answer, but the problem is, if I deleted "values" as you pointed out, and then execute it again, I got error like "ERROR at line 3:
ORA-03113: end-of-file on communication channel", and I was then disconnected with server, I have to relogin SQLplus, and do everything from beganing.
so what 's wrong caused disconnection, I can't find any triggers related. it is so wired?
I wonder if anyone can help me about this.
thank you very much
jerry
yingkuan
Posts: 1,801
From: San Jose, CA
Registered: 10/8/98
Re: what's wrong with this SQL?
Posted: Jan 16, 2007 9:59 AM in response to: jerrygreat Reply
Dup Post
jerrygreat
Posts: 8
Registered: 1/3/07
Re: what's wrong with this SQL?
Posted: Jan 16, 2007 10:00 AM in response to: Eric H Reply
Hi,
acturlly what I do is debugging a previous developer's scipt for data loading, this script was called by Cron work, but it never can be successfully executed.
I think he use union for eliminating duplications of rows, I just guess.
thank you
jerry
mpowel01
Posts: 1,516
Registered: 12/7/98
Re: what's wrong with this SQL?
Posted: Jan 16, 2007 10:03 AM in response to: yingkuan Reply
Scratch the VALUES keyword then make sure that the select list matches the column list in number and type.
1 insert into marktest
2 (fld1, fld2, fld3, fld4, fld5)
3* select * from marktest
UT1 > /
16 rows created.
HTH -- Mark D Powell --
Jagan
Posts: 41
From: Hyderabad
Registered: 7/21/06
Re: what's wrong with this SQL?
Posted: Jan 16, 2007 10:07 AM in response to: jerrygreat Reply
try this - just paste the code and give me the error- i mean past the entire error as it is if error occurs
INSERT INTO xhealthcall_script_data
(xhc_call_ended, xhc_switch_port, xhc_script_id,
xhc_fax_specified)
SELECT TO_DATE (hh_end_date || ' ' || hh_end_time, 'MM/DD/YY HH24:MI:SS'),
hh_switchport, hh_script, 'N'
FROM tmp_healthhit_load
WHERE hh_script != 'BROCHURE'
UNION
SELECT TO_DATE (hh_end_date || ' ' || hh_end_time, 'MM/DD/YY HH24:MI:SS'),
hh_switchport, hh_script, 'N'
FROM tmp_healthhit_load
WHERE hh_script != 'BROCHURE';
Regards
Jagan
jerrygreat
Posts: 8
Registered: 1/3/07
Re: what's wrong with this SQL?
Posted: Jan 16, 2007 11:31 AM in response to: Jagan Reply
Hi, Jagan:
thank you very much for your answer.
but when I execute it, I still can get error like:
ERROR at line 1:
ORA-03113: end-of-file on communication channel
so wired, do you have any ideas?
thank you very muchAnd this one,
Aother question about SQL?
I thought I already told him to deal with
ORA-03113: end-of-file on communication channel
problem first.
There's nothing wrong (syntax wise) with the query. (of course when no "value" in the insert) -
What's wrong with my SQL statement?
Guys,
Please help me with this one.
I am using Oracle JDBC Driver 9.2.0. When I did "select column1, column2 from tableName where rownum<1000", it was really fast. But when I do "select column1, column2 from tableName where rownum between 100 and 200", it won't return. The whole program just sit there, like there is some kind of infinite loop going on or something. I don't know Oracle database at all. Is there anything wrong with my SQL statements or there is some special Oracle SQL statement requirement/syntax?
Thanks.Guys,
Please help me with this one.
I am using Oracle JDBC Driver 9.2.0. When I did
"select column1, column2 from tableName where
rownum<1000", it was really fast. But when I do
"select column1, column2 from tableName where rownum
between 100 and 200", it won't return. The whole
program just sit there, like there is some kind of
infinite loop going on or something. I don't know
Oracle database at all. Is there anything wrong with
my SQL statements or there is some special Oracle SQL
statement requirement/syntax?
Thanks.
why don't you just try a standard WHERE
"select column1, column2 from tableName where rownum > 100 and rownum < 200"
Maybe you are looking for
-
How to convert date from "yyyymmdd" to "MM/DD/YYYY" format
1. I have one BLDAT field in my internal table. its getting updated from input file. 2. The value in the input file is like yyyymmdd. So the internal table field is filled like this "YYYYMMDD". 3. After this,I have to compare this internal t
-
Custom reprot to get transfer user information in OIA 11g
Hi , As per my requirement we have to developed custom report for "*List of users who transferred to a new Direct Manager*" . To identify the transfer event we are using event listner in OIA 11g. Could you please provide me pointer how to fetch the t
-
Oracle 10.2.0.3 - LINUX 64bit to sql server 2003
I have applied Patch 5965763 and installed DG4ODBC in seperate oracle home I have the Data Direct ODBC drivers for linux 64-bit and am using ddsqls24.so driver my connection to sql server 2003 is "AFMAC" my listener on 11.2 works and is started from
-
Serious problem with 2 accounts
Hi, I am encountering a strange problem. I am using mail.app with about 6 different e-mail accounts. I recently subscribed to a new service provider for work, and have several email accounts on their server and I access them by POP3. But from time to
-
My boyfriend was messing with my itouch and changed the password at complete random so he has no idea what it is either. I was thinking about restoring it, but i'm not sure if that permanantly deletes all my photos and progress in my apps. If I resto