I am trying to update a field from a value of 10 to a value of 20, unless a record for that City already is in the table with that value. I can do a straight update, but then I might get 2 records that are identical. I don't know how to code sql to do this.
select * from zone z
set type_seq...
I was surprised when I first started working on the system that it was not a date field, but its a vendor supplied system and we have no control over it or the coding. We can only write reports off of the data.
Thanks Mufasa,
The depart_date is not a date field, so I did a to_date on it and it worked great. Made the code much cleaner. Thanks for your help!
select to_date(depart_date,'yyyymmdd') as "Departure Date",
decode(out_code,0,0,1) "out_code",
count(*) "Trips"
from departure_table...
I tried doing the case as
CASE WHEN (out_code = 0) THEN '0'
ELSE '1'
END as out_code2,
and grouping on depart_date, out_code2, but it says
ORA-00904: "OUT_CODE2": invalid identifier
Do I need to code the expression again in the Group clause?
I have some SQL code which I execute to feed to a spreadsheet for percentages. Out_code used to have a value of "0" or "1". Now it has multiple values for non-zero codes.
I want to make my output have only 2 lines per date: a line for "0" and a line for "1", but I have tried decode and case...
Do you flag them to be deleted from the server? I have had this problem, but it was usually on the ISP's end that kept resending them to me. However, if you say to delete from server, they should go away.
I know that the ChDir should work, but for some reason it isn't. I have tried ChDir "\\123.45.10.66\shared\CSV" and ChDir "\\hmm04\shared\CSV" but although it does not give any error, it still is opening to a directory on my C: drive.
Sorry, I hit submit instead of preview. This is easier to read:
Yes I tried ChDir "\\Hmm04\Shared\CSV\Daily Reports" and got the same results.
I have the network drive mapped to the letter "G" and can get it to work this way:
ChDir "G"
ChDir "CSV\Daily Reports"
But i don't know what the...
Yes I tried [b]ChDir "\\Hmm04\Shared\CSV\Daily Reports" [\b] and got the same results.
I have the network drive mapped to the letter "G" and can get it to work this way:
[code]ChDir "G"
ChDir "CSV\Daily Reports"[\code]
But i don't know what the users will have the drive mapped to, or if they...
I have an Excel macro that runs when a spreadsheet opens and I want it to give an open file message box that is pointing to a network drive where some csv files are stored. My problem is that the open box defaults to the last folder opened and I have not been able to change it to the network...
Set variables for the date(s) and make the call using those variables. Put the command inside of back ticks (not single quotes).
$Date1 = "2008/04/05";
$Date2 = "2008/04/06";
`nfdump -R /../../ -t $Date1.09:00:00-$Date2.10:00:00`;
Thanks for the responses. I had written a shell script to do this extract on 14 files and the * made it very easy to repeat the code. I can do it with the enumeration, but it takes more time to code and means the script isn't quite as reusable, since they want to add more tables in the future.
I am generating an extract file using a "select * from table". I have been told that this will not always give me the columns in the same sequence and that I need to do a "select colname1, colname2, colname3, etc from table" in order to guarantee the results are the same each time.
Does anyone...
Thanks hoinz, moving those lines after sqlplus worked (and removing the set on the WHENEVER's)
It is a sqlplus call embedded in a unix script and now I am capturing the error as I had hoped.
I have a script which calls SQLPLUS and passes the login information. It is working great, but if the database is down or if it passes a bad parameter, the connect does not work, but I still get a return code of zero. Is there a way to capture when there is a connect error and exit with a...
I need to extract data from about a dozen tables to pipe-delimited files. Some of these have 70-80 fields in them. I want to extract all fields from the selected records. Is there an easier way to insert the delimiters other than
Select field1, '|', field2, '|', .... field75 from table1
where...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.