I need to covert the following MS SQL query to Oracle.
The query is as follows..
SELECT B.AL_DESCRIPTION,Count(C.TC_STATUS)
FROM ALL_LISTS A, ALL_LISTS B, TESTCYCL C
Where B.AL_FATHER_ID = A.AL_ITEM_ID
And C.TC_STATUS = B.AL_DESCRIPTION
And A.AL_DESCRIPTION = 'Status'
And (C.TC_EXEC_DATE = @ExecutionDate@
Or C.TC_STATUS = 'No Run')
Group By B.AL_DESCRIPTION
Union
SELECT B.AL_DESCRIPTION,0
FROM ALL_LISTS A, ALL_LISTS B
Where B.AL_FATHER_ID = A.AL_ITEM_ID
And A.AL_DESCRIPTION = 'Status'
And Not Exists (Select 1 From TESTCYCL C Where C.TC_STATUS = B.AL_DESCRIPTION)
Order By 1
Is
What does this below mean in MySql
And (C.TC_EXEC_DATE = @ExecutionDate@Is ExecutionDate a variable name?
Then replace it by..
And (C.TC_EXEC_DATE = TO_DATE(ExecutionDate,'DD-MON-YYYY')If ExecutionDate is not a date datatype
I guess you are trying to compare the value of TC_EXEC_DATE with some variable value.
If you are using bind variable then you can substitute as
And (C.TC_EXEC_DATE = TO_DATE(&ExecutionDate,'DD-MON-YYYY')check this,
Here I am taking value at run time.
SQL> select empno,ename,hiredate
2 from emp
3 where hiredate > &dt;
Enter value for dt: '22-MAY-1981'
old 3: where hiredate > &dt
new 3: where hiredate > '22-MAY-1981'
EMPNO ENAME HIREDATE
7654 MARTIN 28-SEP-81
7782 CLARK 09-JUN-81
7788 SCOTT 19-APR-87
7839 KING 17-NOV-81
7844 TURNER 08-SEP-81
7876 ADAMS 23-MAY-87
7900 JAMES 03-DEC-81
7902 FORD 03-DEC-81
7934 MILLER 23-JAN-82
9 rows selected.
Using a variable
SQL> declare
2 eno number;
3 name varchar2(50);
4 edate date;
5 dt date :='23-JAN-1982';
6 begin
7 select empno,ename,hiredate into eno,name,edate
8 from emp where hiredate = dt;
9 dbms_output.put_line(Eno||' '||name||' '||edate);
10 end;
11 /
7934 MILLER 23-JAN-82
PL/SQL procedure successfully completed.Twinkle
Similar Messages
-
Need solution for the following sync error: "iTunes could not sync calendars to the iPad "iPad name" because an error occurred while sending data from the iPad"
I want to add that I deleted all the old back-ups and created a new back-up without any issues except sync problem.
-
Do we need to put the following code in the web-xml for the project to run
Hi^^^,
actually I have created a project in Eclipse WTP and I am running it from remote server. Its giving me 404 error when I tried to run it.
I know 404 error is generally due to some error in deployment descriptor.
I am going through this tutorial for creating project in eclipse WTP
this says that I need to include the following code in web-xml. Please look at the quotes below
"Web modules in J2EE has a deployment descriptor where you configure the web application and its components. This deployment descriptors is called the web.xml. According to the J2EE specification, it must be located in the WEB-INF folder. web.xml must have definitions for the Servlet and the Servlet URI mapping. Enter the following lines into web.xml:"
"Listing 2. Deployment Descriptor web.xml"
<servlet>
<servlet-name>Snoop Servlet</servlet-name>
<servlet-class>org.eclipse.wtp.tutorial.SnoopServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>Snoop Servlet</servlet-name>
<url-pattern>/snoop/*</url-pattern>
</servlet-mapping>
My question is, it is necessary to include the above lines between <servlet> and </servlet-mapping> in web-xml
thanks and regards,
Prashantpksingh79 wrote:
actually I have created a project in Eclipse WTP and I am running it from remote server. Its giving me 404 error when I tried to run it.
I know 404 error is generally due to some error in deployment descriptor. what's the url you've put.
<servlet>
<servlet-name>Snoop Servlet</servlet-name>
<servlet-class>org.eclipse.wtp.tutorial.SnoopServlet</servlet-class>
</servlet> Every Servlet has to have a <servlet></Servlet> tag in the web.xml
the <servlet-name>is for the naming the servlet and the <servlet-calss>is for class file of the servlet in your case the .class file is to be in the package of tutorial,if it's not then how the container will no where the calss file is
<servlet-mapping>
<servlet-name>Snoop Servlet</servlet-name>
<url-pattern>/snoop/*</url-pattern>
</servlet-mapping>You type something in your url likk http://localhost:8080/webappname (Tomcat server),so for url mapping instead of typing the entire class file name ,you just enough have to type what you've put in the <url-mapping> tag and it has to be inside of <servlet-mapping>
I think the problem is in <url-pattern> change it like /snoop<url-pattern>
My question is, it is necessary to include the above lines between <servlet> and ></servlet->mapping> in web.xmlSo now you think whether you need something inside <servlet>and </servlet-mapping> -
While executing the following pl/sql block Iam getting following error
While executing the following pl/sql block
Iam getting following error
ORA-06550: line 5, column 11:
PLS-00320: the declaration of the type of this expression is incomplete or malformed
ORA-06550: line 5, column 11:
PL/SQL: Item ignored
declare
TYPE t_customer_details IS REF CURSOR;
o_customer_details t_customer_details;
v_rec o_customer_details%ROWTYPE;
begin
o_customer_details:=pkg_search.fngetcustdetails( 2727,1000841, NULL,NULL,119105329);
LOOP
FETCH o_customer_details INTO rec ;
EXIT WHEN o_customer_details%NOTFOUND;
DBMS_OUTPUT.PUT_LINE(' print' );
END LOOP;
CLOSE o_customer_details;
end;sorry
declare
TYPE t_customer_details IS REF CURSOR;
o_customer_details t_customer_details;
begin
o_customer_details:= pkg_search.fngetcustdetails( 2727,1000841, NULL,NULL,119105329);
FOR v_rec IN o_customer_details
LOOP
DBMS_OUTPUT.PUT_LINE(' print' );
END LOOP;
END;I changed code,
Can you say , o_customer_details:= pkg_search.fngetcustdetails( 2727,1000841, NULL,NULL,119105329); is it right?
pkg_search.fngetcustdetails return ref cursor?? -
Error: this type needs one of the following values('true','false')
I'm trying to use <c:if> in a jsp (in Workshop 8.1), as in:
<c:if test="1 == 1">
<!-- something here -->
</c:if>
But, I get the following message when I hover over the error indicator
at the test:
Error: this type needs one of the following values('true','false')
It will actually work if I do:
<c:if test="true">
<!-- something here -->
</c:if>
but, of course, that's useless.
Am I missing something here?David Karr wrote:
> The value of the "test" attribute needs to be an Expression Language expression. Try changing it to "${1 == 1}", and that should work.
Actually, I had tried that, and it would have worked that way if I had
the right taglib declaration -- I had accidentally left in the rt
versions, so a <%= test %> type of expression worked.
But, that's not the way I wanted to do it, so I put the non-rt versions
in, along with tld and jar files that I had in some other directories,
then it worked fine. In the process, when searching my hard drive for
standard.jar, I noticed I had four or five different versions, each with
a slightly different size. Of course, I had to tinker, and downloaded
the zip from Apache, figuring it would be best to have a matched set of
tlds and jars.
And now I get an error that the matching class cannot be found:
> ERROR: response.jsp:1: Package org.apache.taglibs.standard.tag.el.core contains no member type of this name.
and
> ERROR: response.jsp:14: The tag handler class was not found "org.apache.taglibs.standard.tag.el.core.IfTag".
But, if I navigate the standard .jar that is in my WEB-INF/lib
directory, lo and behold, there is the file IfTag.class in what appears
to be the correct package. -
I can't see music/video files from my iPad2 or Nano on my Phillips home theatre. Do I need to covert the files?
The problem is I can no longer back up my photo and video files taken on my phone, saved to my mac, by copying them and saving them on a USB stick or other external hard drive.
Select the photos and videos in Photos and use the command "File > Export" and select a folder on your USB stick to save the photos to. -
Finding the Text of SQL Query causing Full Table Scans
Hi,
does anyone have a sql script, that shows the complete sql text of queries that have caused a full table scan?
Please also let me know as to how soon this script needs to be run, in the sense does it work only while the query is running or would it work once it completes (if so is there a valid duration, such as until next restart, etc.)
Your help is appreciated.
Thx,
MayuranFinding the Text of SQL Query Causing Full Table Scan
-
How to insert the records using sql query
hi,
i insert the record uisng sql query and DOTNET programme successfully and increase the doc num .ubut when i try to add record using SAP B1 the old Doc no show.It means its not consider the docnums which are not inserted by sql query.
how can i solve this problem?
Regards,
M.Thippa ReddyYou are not support use Insert / Update / Delete on SAP Databases directly.
SAP will not support any database, which is inconsistent, due to SQL-Queries, which modify datasets or the datastructure of the SAP Business One Database. This includes any update-, delete- or drop-statements executed via SQL-Server Tools or via the the query interface of SAP Business One
Check SAP Note: 896891 Support Scope for SAP Business One - DB Integrity
[https://websmp130.sap-ag.de/sap(bD1lbiZjPTAwMQ==)/bc/bsp/spn/smb_searchnotes/display.htm?note_langu=E¬e_numm=896891] -
Executing Native SQL query for oracle
Hi,
I want to run following native sql query but it is giving me error ora:933,
DATA: BEGIN OF WA,
TSP_NAME(255) TYPE C,
PER_USAGE(10) TYPE C,
END OF WA.
EXEC SQL PERFORMING loop_output.
select t.tablespace_name,'(' || TO_CHAR(ROUND(100*(NVL(b.bytes,0)/NVL(a
.bytes,0)))) || '%)' "TSUsed%" from dba_tablespaces t,
( select tablespace_name, sum(bytes)/1024/1024 bytes
from dba_data_files group by tablespace_name) a,
( select e.tablespace_name, sum(e.bytes)/1024/1024 bytes
from dba_extents e group by e.tablespace_name ) b,
( select f.tablespace_name, sum(f.bytes)/1024/1024 bytes
from dba_free_space f group by f.tablespace_name ) c
where t.tablespace_name = a.tablespace_name(+) and
t.tablespace_name = b.tablespace_name(+) and
t.tablespace_name = c.tablespace_name(+) into :wa.
ENDEXEC.
Please provide me the soln
Regards,
Bharat MistryORA-00933: SQL command not properly ended.
Try:
EXEC SQL PERFORMING loop_output.
select
into :wa
ENDEXEC.
(No "." at the end). If that doesn't work, try ending it with a ";"
Rob -
Different Results from SQL-Query in Oracle 10.2 and Oracle 11.2
Look at the following example:
CREATE TABLE GZP_PLAN (GZP_ID
NUMBER(9) NOT NULL, PARENT_GZP_ID NUMBER(9),
CONSTRAINT GZP_PLAN_PK1 PRIMARY KEY(GZP_ID)
USING INDEX
TABLESPACE USERS
TABLESPACE USERS;
insert into GZP_PLAN values(1,NULL);
CREATE TABLE GZP_WB (OBJECTID NUMBER
NOT NULL, GZP_ID NUMBER(10),
CONSTRAINT GZP_WB_PK1_1 PRIMARY KEY(OBJECTID)
USING INDEX
TABLESPACE USERS
TABLESPACE USERS;
insert into GZP_WB values(1,1);
CREATE OR REPLACE VIEW VW_GZP (GZP_ID1) AS
SELECT xxx.gzp_id
FROM gzp_plan xxx
WHERE gzp_id IN (
SELECT MAX (z.gzp_id) zzz
FROM gzp_plan z
START WITH z.gzp_id = xxx.gzp_id
CONNECT BY PRIOR gzp_id = parent_gzp_id);
-- query
select a.* from GZP_WB a where gzp_id in (select gzp_id1 from vw_gzp);
Result in Oracle 10.2. (Windows Server 2003 32-bit, Oracle 10.2.0.2 or Oracle 10.2.0.5, Enterprise Edition)
OBJECTID GZP_ID
*1 1*
Result in Oracle 11.2 (Windows Server 2008 64-bit, Oralcle 11.2.0.2, Enterprise Edition or Standard Edition One)
no rows selected
The result of the following queries are identical in Oracle 10.2 and 11.2
SQL> select * from GZP_WB where to_char(gzp_id) in
2 (select to_char(gzp_id1) from vw_gzp);
OBJECTID GZP_ID
1 1
SQL>
SQL> select a.* from GZP_WB a, vw_gzp b where a.gzp_id=b.gzp_id1;
OBJECTID GZP_ID
1 1The solution is Oracle 11.2.0.3 - patchset released 11th November.
-
Sub-Select SQL query in Oracle BI Answers
Hi
What's the proper usage of Sub-Select SQL query in Oracle BI Answers Version Oracle Business Intelligence 10.1.3.2.1?
I get [SQL_STATE: HY000] [nQSError: 10058] A general error has occured when trying to Sub Select query like:
itemno = (SELECT MIN(orders.itemno) FROM mydatabase where rownum < 2 order by orders.itemno)Maybe the best is to create a new physical and logical object for your sub-select and join this with your current objects.
-
How to convert sql query to oracle query?
Hi all,
Hope doing well,
sir i am using oracle database where i am running my sql query in oracle. but this query is not working properly. i used sql developer translation scratch editor to convert that.
it's converted but i am not getting the exact value.
which i was getting in sql server.
here is my query below:
SELECT C.*,ISNULL(P.Comp_Name,'') + ' (' + ISNULL(P.Comp_ID,'') + ')' Parent FROM Comp_Master C LEFT JOIN Comp_Master P ON C.Parent_ID = P.Comp_ID Where C.Comp_ID='C02'
please convert it into oracle so that i can use this query
thanks in advance.Try --
1. Use NVL instead of isNull
2. Use *||* instead of +*
/* Formatted on 9-13-2012 4:39:09 PM (QP5 v5.163.1008.3004) */
SELECT c.*, NVL (p.comp_name, '') || ' (' || NVL (p.comp_id, '') || ')' parent
FROM comp_master c LEFT JOIN comp_master p ON c.parent_id = p.comp_id
WHERE c.comp_id = 'C02'
PS - Do remember to mark the solutions as Helpful or Correct. Thanks for understanding. -
Restating my issue / question...
When I send email from this iMac, there is a string of characters assigned. The characters are all the "alpha numeric" characters on the QWERTY key board. This only occurs when email is sent from this iMac. The issue does not manifest when using any other lap top or computer.
Hence, I have ruled out the issue is a yahoo mail matter.
Again, I can access the Yahoo mail account form multiple devices and send email without unintended assignment of character strings, but when I send wmail using this iMac, the issue happens everytime.
Characters are stacked verticaly in a column. It looks as if all characters (except function keys) are included in the string.
Any ideas?
GMcPlease read this whole message before doing anything.
This procedure is a diagnostic test. It won’t solve your problem. Don’t be disappointed when you find that nothing has changed after you complete it.
Third-party system modifications are a common cause of usability problems. By a “system modification,” I mean software that affects the operation of other software — potentially for the worse. The following procedure will help identify which such modifications you've installed. Don’t be alarmed by the complexity of these instructions — they’re easy to carry out and won’t change anything on your Mac.
These steps are to be taken while booted in “normal” mode, not in safe mode. If you’re now running in safe mode, reboot as usual before continuing.
Below are instructions to enter some UNIX shell commands. The commands are harmless, but they must be entered exactly as given in order to work. If you have doubts about the safety of the procedure suggested here, search this site for other discussions in which it’s been followed without any report of ill effects.
Some of the commands will line-wrap or scroll in your browser, but each one is really just a single line, all of which must be selected. You can accomplish this easily by triple-clicking anywhere in the line. The whole line will highlight, and you can then copy it. The headings “Step 1” and so on are not part of the commands.
Note: If you have more than one user account, Step 2 must be taken as an administrator. Ordinarily that would be the user created automatically when you booted the system for the first time. The other steps should be taken as the user who has the problem, if different. Most personal Macs have only one user, and in that case this paragraph doesn’t apply.
Launch the Terminal application in any of the following ways:
☞ Enter the first few letters of its name into a Spotlight search. Select it in the results (it should be at the top.)
☞ In the Finder, select Go ▹ Utilities from the menu bar, or press the key combination shift-command-U. The application is in the folder that opens.
☞ Open LaunchPad. Click Utilities, then Terminal in the icon grid.
When you launch Terminal, a text window will open with a line already in it, ending either in a dollar sign (“$”) or a percent sign (“%”). If you get the percent sign, enter “sh” and press return. You should then get a new line ending in a dollar sign.
Step 1
Triple-click the line of text below to select it:
kextstat -kl | awk '!/com\.apple/{printf "%s %s\n", $6, $7}' | open -f -a TextEdit
Copy the selected text to the Clipboard by pressing the key combination command-C. Then click anywhere in the Terminal window and paste (command-V). A TextEdit window will open with the output of the command. Post the contents of that window, if any — the text, please, not a screenshot. You can then close the TextEdit window. The title of the window doesn't matter, and you don't need to post that. No typing is involved in this step.
Step 2
Repeat with this line:
{ sudo launchctl list | sed 1d | awk '!/0x|com\.(apple|openssh|vix)|org\.(amav|apac|cups|isc|ntp|postf|x)/{print $3}'; sudo defaults read com.apple.loginwindow LoginHook; } | open -f -a TextEdit
This time you'll be prompted for your login password, which you do have to type. Nothing will be displayed when you type it. Type it carefully and then press return. You may get a one-time warning to be careful. Heed that warning, but don't post it. If you see a message that your username "is not in the sudoers file," then you're not logged in as an administrator.
Note: If you don’t have a login password, you’ll need to set one before taking this step. If that’s not possible, skip to the next step.
Step 3
launchctl list | sed 1d | awk '!/0x|com\.apple|org\.(x|openbsd)/{print $3}' | open -f -a TextEdit
Step 4
ls -1A /e*/mach* {,/}L*/{Ad,Compon,Ex,Fram,In,Keyb,La,Mail/Bu,P*P,Priv,Qu,Scripti,Servi,Spo,Sta}* L*/Fonts 2> /dev/null | open -f -a TextEdit
Important: If you formerly synchronized with a MobileMe account, your me.com email address may appear in the output of the above command. If so, anonymize it before posting.
Step 5
osascript -e 'tell application "System Events" to get name of every login item' | open -f -a TextEdit
Remember, steps 1-5 are all copy-and-paste — no typing, except your password. Also remember to post the output.
You can then quit Terminal. -
How to improve performance in the following PL/SQL
I'm running this PL/SQL in a Job step inside a UNIX job, is taking too long to finish and is a simple process to do but definetely there is something that I need to do.
I have to find records that are not included in my T_XREF table from my temporary table T_TEMP, identify those records and insert a new record with values located in the T_TEMP table into the T_XREF table.
T_TEMP has 2 millions records and T_XREF has 12,000 records, I have a Unique IDX in T_TEMP (claim,num_dtl) and a NON UNIQUE IDX by (7 fields).
on the T_XREF table I have 1 UNIQUE IDX (comp_key).
this is part of the PL/SQL:
DECLARE
v_rowid ROWID;
CURSOR c_FixComp1 IS
SELECT DISTINCT sak_acct,ind_split,cde_state,cde_fed,med_a,med_b,ind_cnty
FROM T_TEMP
WHERE claim >= 0;
BEGIN
FOR r_FixComp1 IN c_FixComp1 LOOP
BEGIN
SELECT ROWID
INTO v_rowid
FROM T_XREF x
WHERE x.sak_acct = r_FixComp1.sak_acct
AND x.ind_split = r_FixComp1.ind_split
AND x.cde_state = r_FixComp1.cde_state
AND x.cde_fed = r_FixComp1.cde_fed
AND x.med_a = r_FixComp1.med_a
AND x.med_b = r_FixComp1.med_b
AND x.ind_cnty = r_FixComp1.ind_cnty;
EXCEPTION
WHEN NO_DATA_FOUND THEN
INSERT INTO T_XREF
(comp_key,
sak_acct,
ind_split,
cde_state,
cde_fed,
med_a,
med_b,
ind_cnty)
VALUES
(seq_xref.Nextval,
r_FixComp1.sak_acct,
r_FixComp1.ind_split,
r_FixComp1.cde_state,
r_FixComp1.cde_fedt,
r_FixComp1.med_a,
r_FixComp1.med_b,
r_FixComp1.ind_cnty);
WHEN OTHERS THEN
cnt_notinserted := cnt_notinserted + 1;
END;
END LOOP;
COMMIT;
EXCEPTION
WHEN OTHERS THEN
ROLLBACK;
END;
in my Cursor's query I'm forcing to do a IDX (range scan) and the result of that query is only 1300 rec after doing the DISTINCT of those fields. When starts analyzing record by record this simple script takes more than 10 hrs to run!!!
I'll appreciate any advice you can give me. ThanksThe reason your code is slow is that you are doing something that wasn't even best practice in version 7.0.12. Chris Poole is absolutely correct: There is no reason for any procedural code.
Even if there were a valid reason for PL/SQL the row-by-row cursor fetch construct has been obsolete for 6 years.
Do what Chris is suggesting here and then put away the cursor loops and learn how to write this code:
http://www.psoug.org/reference/array_processing.html
Check out the SLOW_WAY and FAST_WAY demos. -
Need explanation of the following code
HI All,
I need your help on explanation of the following code :
what I don't understand is how it route the request (all the benefit of the replace statement )
If the input is /scarr/LH/SPFLI/402
how he know to route it and
what is the benefit for using the wild card and the concatenate CONCATENATE '^' lv_verif_pattern '$'
Edited by: James Herb on Apr 13, 2010 9:53 AM
Edited by: James Herb on Apr 13, 2010 9:53 AMDATA: lt_routing_tab TYPE z_resource_routing_tab,
CONSTANTS: param_wildcard TYPE string VALUE '([^/])*'.
FIELD-SYMBOLS: <ls_routing> LIKE LINE OF lt_routing_tab.
CALL METHOD get_routing
RECEIVING
rt_routing_tab = lt_routing_tab.
LOOP AT lt_routing_tab ASSIGNING <ls_routing>.
* replace all parameters placeholders by regex
lv_verif_pattern = <ls_routing>-url_info.
lv_signature = <ls_routing>-url_info.
REPLACE ALL OCCURRENCES OF REGEX '\{([A-Z]*[_]*[a-z]*[0-9]*)*\}'
IN lv_verif_pattern WITH param_wildcard.
CONCATENATE '^' lv_verif_pattern '$' INTO lv_verif_pattern.
* check if pattern matches current entry
FIND ALL OCCURRENCES OF REGEX lv_verif_pattern
IN url_info MATCH COUNT lv_count.
* pattern matched
IF lv_count > 0.
* get controller class name
lv_controller_name = <ls_routing>-handler_class.
ls_class-clsname = lv_controller_name.
* check if class exists
* class found
IF sy-subrc = 0.
* create controller
CREATE OBJECT eo_controller TYPE (lv_controller_name).
* create parameter table
SHIFT lv_verif_pattern RIGHT DELETING TRAILING '$'.
SHIFT lv_verif_pattern LEFT DELETING LEADING ' ^'.
SPLIT lv_verif_pattern AT param_wildcard INTO TABLE lt_url_parts.
lv_url_info = url_info.
LOOP AT lt_url_parts INTO lv_url_part.
SHIFT lv_signature LEFT DELETING LEADING lv_url_part.
SHIFT lv_signature LEFT DELETING LEADING '{'.
SHIFT lv_url_info LEFT DELETING LEADING lv_url_part.
Edited by: James Herb on Apr 13, 2010 9:56 AM
Maybe you are looking for
-
Ok, Hi. I'll first admit this is my first post so go easy on me! I just bought a used iBook G3 and it was working fine for a while until about a month ago when all kinds of weird things stared happening. Some of which those problems I solved from rea
-
Hi Experts, I am working on a 856 AS2 to file scenario.I have configured the scenario as following: IR External definition:1) FunctionalAcknowlegementSeeStd, A_856_V4010 and A_997_V4010 Message interface: A_856_V4010_OB, A_997_V4010_OB, SB_Functional
-
Xfa.layout has no properties
When I import a PDF and use it as a fixed background for my forms, I get an error inside my validation script that runs through all the fields by using xfa.layout.pageContent(nPageCount,"field"); how can I solve this issue? thanks a lot. fabian
-
I press + to add an agregate device and no new device appears! Anyone have the same problem?
-
hi experts, My requirement is when I schedule ip30 once in a week for next 50 days system will generate orders due with next 50 days only but you know some of the plans are yearly & their call horizon is 0 when we schedule the plan system generating