SQL & PL/SQL

SQL and PL/SQL related topics.

PS Query - Need the SQL to create a REPLACE statement

I am still learning how to build and manipulate queries within PeopleSoft and I'm certainly no expert with SQL, but I am looking to find the correct statement to have the query look at a person's years of service with the company (which is calculated using an expression) and when the person's years of service are 5, 10, 15, 20 years, I need the query to return a character, such as *, in a separate field. I cannot build this into the criteria because I do not want to exclude those rows of data where the years of service are other than 5, 10, 15 and so on.

How do I return multiple rows when using START WITH in an Oracle stored procedure?

Having trouble displaying a user approval route for all users and their approval limits
Al reports to Bill, Bill reports to Chris, Chris reports to Dean.
I am trying to show a report that summarizes all user ids.
The error is ORA-01422: exact fetch returns more than requested number of rows.
Using Oracle 8i.
--------------------------
Al - $0 limit
Bill - $10 limit
Chris - $20 limit
Dean - $40 limit
-----
Bill - $10 limit
Chris - $20 limit
Dean - $40 limit
----
Chris - $20 limit
Dean - $40 limit
----
Dean - $40 limit

Passing check variables fronm the front end as parameters to Stored Procedure in SQL SERVER2005

Hi All,
I want to pass variables(Tables) which are checked in check box in the front to the stored procedure in sql server2005.How can i do this.Can any one please help me up please.i want to call the procedure from jsp code.

Thanks in Advance,
Ashok K.

Pushing tables from one database to another database

Hi,
Im using SQLServer2005.I have some tables in 1 database CRM90 which are not present in another database HRMS9.I want to move those tables to HRMS9 from CRM90 which are not present in HRMS9.I want to do this by writing a procedure in SQL Server2005.Can anyone help me up please!!

Thanks in Advance,
Ashok K.

compare data from two identical tables

hi guys i am tryin to compare data from two identical tables E6900 and M9000 and this my DBlink ops$mis_exec.mis_sub_prof@prod
so my query is as follows i am not sure whether i am on the right track

select * from ops$mis_exec.mis_sub_prof@prod minus select * from ops$mis_exec.mis_sub_prof;

Retrieving Tables from different databases using database links with Escape Characters

Hi!
I want to get tables which are present in one database and not present in other database using database links.The tables must start with PS_.
I wrote a query for this.but its not functioning.I want to get it using Escape characters.Can u help me out please..

SELECT C.TABLE_NAME FROM USER_TABLES C WHERE C.table_name like ‘PS\_%’ESCAPE’\’ AND C.TABLE_NAME NOT IN(SELECT A.TABLE_NAME FROM USER_TABLES A
WHERE A.table_name like ‘PS\_%’ESCAPE’\’
INTERSECT
SELECT B.TABLE_NAME FROM USER_TABLES@PJCRM B
WHERE B.table_name like ‘PS\_%’ESCAPE’\’)

ORACLE Long Character

Is it possible to select rows from a table where the Long Character field contains a value?

My group by is not working when I use the decode function??

Here is my query.. HELP!!

SELECT DECODE(PMRTAGGR_AGG.PMR_TRD_EFF_MO_ID,
1,1,2,1,3,1,4,2,5,2,6,2,7,3,8,3,9,3,10,4,11,4,12,4) AS
PMR_TRD_EFF_MO_ID
,SUM(PMRTAGGR_AGG.PMR_GRSS_SLS_AMT)
,SUM(PMRTAGGR_AGG.PMR_GRSS_REDS_AMT)
FROM PMRTAGGR_AGG,
PFUND_BSE,
PFIRM_BSE
WHERE (PMR_RETAIL_FL = 'Y' OR
PMR_RTL_401K_FL = 'Y')
AND PFU_MFC_NM IN ('PUTNAM','CAYMAN','ALTERNATIVE
PRODUCTS','ALLSTATE','HARTFORD')
AND PFU_PROD_NM <> 'PRIME MONEY MARKET'
-- AND PFI_DST_DSTRB_NO NOT IN ('92367', '93440', '69508', '51237' ,
-- '99978','52912', '52918', '98315', '98713')

Creating Groups

I would like to use a GROUP BY statement ( such as GROUP BY month) but instead of having 12 months that are being grouped by I would like to put january and Febuary in a group and march, april, may, june, july in a group and the rest in another group or something like this ( make my own groups using one of the columns). Is this a simple statement? I have thought about adding another column, but thought there might be an easier way without having to add a seperate column. I would like to also change the grouping easily without deleting columns and recreating new ones.