I am currently working on a Data Dictionary project where we need to run a few rules against the give data sources to see if they all comply together.
One of the rule is to check if the no. is negative or not. So for that what I tried to do was to check if first the field is number or not and then check on if it is negative or not.
This is the code I am currently trying on and is not looking good.
SELECT 1 FROM DUAL WHERE decode(DECODE( TRANSLATE('-123.45','-0.123456789',''), NULL, 1,0), 1,substr('-123.45',1,1) ,' ' ) = '-'
When I use JDBC to retrieve the data and convert it to mill seconds, and it also shows as negative time. My question is the retrieved time doesn't show the negative date, but obvious it is a BC date and earlier than 0001-01-01.
1. How can we detect/show the date to show correctly for the BC date without checking c.time < to_date('0001-01-01','YYYY-MM-DD')? (I am wondering if there is format configuration to show the time like 17-JUN-08 04.06.22.893 PM BC, or something to show the time is negative )
I am working on a script that is reading from a numeric column converting it to a character string where the decimal is dropped (assumed) and the value is padded with leading zeros to fill the specified lengh. Using to_char(payment_amt,'FM0000000V00') is working fine for non-negative values. When the value of the field is a negative number the output includes a leading - (i.e., -000002458).
For the negative numbers I need to convert them to a 'Signed EBCDIC' value, where the last digit is converted to a specified character (in the above example it would be changing the 8 to a Q) and also replace the - with a zero, resulting in 00000245Q.
What I am doing is generating a fixed-length record with values in a specific location. What I'm getting now looks like this:
S -- format mask display both sing + and - MI -- format mask display negative sign at end PR --Returns negative value in <angle brackets>. and Returns positive value with a leading and trailing blank.
I want the output should display only leading negative if the value is negative. I have used S99990.99 as format Mask. but need output should display only leading negative if the value is negative.
i am doing a data transformation using the following function
FLOOR(ONSET_TPQ-VAX_DATE)
Where ONSET_TPQ and VAX_DATE are both dates. Now in a situation where the ONSET_TPQ precedes VAX_DATE I want the result to be null for those records. As an example if ONSET_TPQ= 2000 and VAX_DATE=2010
I want the result to be NULL as I dont want negative values. Any exact SQl syntax on how to do that. DO i write a case statement?
SELECT SCRATTR_ATTR_CODE from scrattr_TEST,scbcrse_TEST where SUBSTR(scbcrse_subj_code,1,3) = SUBSTR(scrattr_subj_code,1,3) and SUBSTR(scbcrse_crse_numb,1,4) = SUBSTR(scrattr_crse_numb,1,4)Returns this
SCRATTR_ATTR_CODE A INS MCSR
How I can make to return someting like A INS MCSR in one row there is a row for every code
hERE is some code to create the tables and insert the data
CREATE TABLE SCRATTR_test ( SCRATTR_SUBJ_CODE VARCHAR2(4 CHAR) NOT NULL, SCRATTR_CRSE_NUMB VARCHAR2(5 CHAR) NOT NULL, SCRATTR_EFF_TERM VARCHAR2(6 CHAR) NOT NULL, SCRATTR_ATTR_CODE VARCHAR2(4 CHAR)
I have a requirement where I want to display amount what I have billed to my client and then how I received my amounts from that Bill. For eg.lets say there is bill no 001 amounting 10000 and after some days I received a part payment cheque/cash from client worth 2000 then he gave second part 2000 and then finally I received 2000. Still 4000 is remaining to be received.So in tabular format I want to display data which will have 3 records of 2000 and one record of balance 4000.
In attached file i have given few examples, where highlighted area is what i want to derive. There are formula's in Collection date, delay by and Int calc. Basically highlighted lines are the ones which should be shown in query result. And data shown above that is what i have right now.
Consider EMPLOYEES table and If an employee 'A' joined in Jan month then he should come under JAN, if employee B and C joined in MARCH month than both has to come under MAR and so on..
OUTPUT: JAN FEB MAR APR MAY JUNE JULY AUG SEP OCT NOV DEC A B D E C
I need to return the stored result in a record by ref cursor. In the below code I am displaying the result through DBMS_OUTPUT.PUT_LINE but i need to do it through ref cursor to display the result.
declare type r_cursor is REF CURSOR; c_emp r_cursor; type rec_emp is record ( name varchar2(20), sal number(6) [code].....
how to write a single query, Also i may add /delete school/class anytime. Query should support mesans everything dynamically should get the data.Even stored procedure will work for me.
i have to display the 10 most costly missions. but if the 11th record has the same cost then it needs to display 11 records instead of 10. how can i do this?
order = the sequence in which they are to be displayed a sub-heading's heading_id refers to the parent heading, likewise an item's sub-heading_id refers to the parent sub-heading.
I assumed there was no need to track child content.
Now, the output format should be something like this, where the sub-headings are not repeated, nor are the items. Sort of like chapters in a book, things in a catalogue, or even topics in a forum.
Where I'm getting hung up is how to query the data so it's quick, efficient, clean and easy to read and maintain. I've only gotten to listing the sub-headings and already the query looks convoluted. So, how should I approach this? Should it be done all in one query, and always checking against the results to know when to print a new heading or sub heading. Or should I run multiple queries and save the results to a variable, and then run sub-queries off that? Is there a better way to do this, am I going about it the hard way or am I in the right direction and just haven't gone far enough with it yet?
I have two columns which I need to add together then devide by 60 in order to display that time in minutes. the problem I am facing is that at times I get numbers above 60 and my client doesn't want to see numbers above 60.
i.e (col1 + col 2)/60 = 34.87
what I need to do is make sure that when the number reaches 60 it moves on to 35.
select * from test where col2=123 will give me null because It doesnt have any values, But can we display some harcoded value when I do not have anything ?
I am trying to create a query that displays the given error message if the result of my COUNT(*) is smaller than 1, but displays the result of my first query (data) if the total count is bigger than 1 (read: the query found data, so it needs to display the rows according to the search).
What do I need to do to display 'data' if 'data2' contains rows?
WITH data AS (SELECT a.order_id, a.session_id, a.log_id, b.date_of_order, a.operation, b.funct_prod_code, b.sts_status_code, b.ost_order_situation_code, c.order_situation_oms,
My form failed to display photo (data type long row).
scenario a) If photo in black and white with width : 472 pixels height: 590 pixels horizontal resolution : 300dpi vertical resolution : 300dpi bit depth : 8 size file : 28KB
scenario b) If photo in color with width : 124 pixels height: 155 pixels horizontal resolution : 75dpi vertical resolution : 75dpi bit depth : 24 size file : 14KB
Above 2 scenario:
My form 6 program can successful display the photo for scenario a , while for scenario b, my form 6 program failed to display the photo.
I have a form in which the fields are not database items i want to display the next record, i know i can use the next_record for the same but it does not work since it is not the database item, is there any way when the item is not the database item and i can see the next record. I use the cursor for loop but since it fecthes all the records in one go it cannot display one record at the time in the form..